Waitevent() error?

BlitzMax Forums/BlitzMax Programming/Waitevent() error?

Retimer(Posted 2008) [#1]
I can't explain it as I haven't changed anything in my app. It worked fine last time I ran it, and now when I try to run it I get an error with waitevent()

"Unhandled Memory Exception Error"

What can cause this? (i'm using maxgui btw)


CS_TBL(Posted 2008) [#2]
tried restart/reboot yet?


Retimer(Posted 2008) [#3]
Yip. Did a microsoft update as well, which lead to a blue screen error on startup and had to fix a bunch of drivers rofl.

Recompiled the modules as well.


jsp(Posted 2008) [#4]
Do you use any hook functions? If yes may check your parameters...


Retimer(Posted 2008) [#5]
nope, no event hooks =(


Dreamora(Posted 2008) [#6]
What does your code do?
That error normally can not happen with WaitEvent unless one of your memory blocks is burnt!


Retimer(Posted 2008) [#7]
Networking before waitevent call. After the waitevent call it draws some stars in event_gadgetpaint to a canvas.


unless one of your memory blocks is burnt!



What exactly does that mean? Hardware issue?


jsp(Posted 2008) [#8]
By chance, do you emit your own events to steer some actions inside the event loop?
For example an extra event_gadgetpaint to have another redraw when needed.


Dreamora(Posted 2008) [#9]
Erm what do you mean by "networking before waitevent call"

There is nothing before it.

In an event driven mainloop everything is controlled through an event, there is nothing "outside" of it as the amount of times the stuff outside would be run is totally out of control as any mousemove would cause it to run again.

Networking normally would be done in TimerEvent for example.

And "After the waitevent call it draws some stars in event_gadgetpaint to a canvas" sounds quite strange as well.

Does your code structure look like:
local id:int
Repeat
  id = waitevent()
  select id
    case EVENT_GADGETREPAINT
      ' Do the repaint stuff here
    
    case EVENT_TIMERTICK
      ' Do the networking here

    ...
  end select
Forever


and the event_gadgetrepaint has logically the regular routine to set the canvas to which it is rendered etc, otherwise you try to draw to NULL which will bomb


Retimer(Posted 2008) [#10]
No, my code has networking checks above the waitevent since I can't produce an event for when data is available, nor do I want it only checked after a timertick is sent, but i've just tried some example files, and peoples submitted code on the forum and i'm getting error heaven with everything. I dont think this is a Blitz/code issue. And come to think about it; i've installed a couple compilers recently that also deal with mingw, which might make sense to cause some of these issues (different compiler versions?)

Will try a reinstall.


In an event driven mainloop everything is controlled through an event, there is nothing "outside" of it as the amount of times the stuff outside would be run is totally out of control as any mousemove would cause it to run again.



That can also be useful for quite a few non-event based things that you want processed as often as possible while leaving the app responsive. In a couple of my bm tests i've used it successfully as a simple priority system. But I do understand what you're getting at with the event-based coding with redraw. It has never caused a problem with the networking above the waitevent though (at least I never had a problem until this issue came up).


Dreamora(Posted 2008) [#11]
Sure you can have it responsive.
The question is why you would destruct a working and powerfull system done by timertick for something thats worthless? Reason is simple: networking has no 0ms response time, so checking it at 0.001 ms is totally worthless kiddie style (same as "render as fast as you can" even thought the screen can't handle more than <= 100 FPS, just at the cost of usefully used CPU time for AI and/or physics). But as you use events you definitely seem to be a few levels above the pure beginner level of programming, same is shown in your postings. But its your decision, its you who will most likely rewrite it at a later date to be on a usefull performance level. (this does not meant that tcp polling is bad. But then use sockets and a TCPConnect class that creates an event hook on generation and use the polling check to fire events for those connection objects so they can work on event base)

Would it be possible to show the gadget repaint part? Currently I would guess that you are mainly not setting a correct drawing target or messing with it (like having 2 canvas) so instead of repainting it your are killing the app.
MAVs, in 99.9% are directly related to media. Either graphical or sound