RE: Thanks

new topic     » goto parent     » topic index » view thread      » older message » newer message

jbrown105 at speedymail.org wrote:
> That makes sense with cooperative multitasking. Preemptive multitasking
> doesn't really need this however.
> 
> Also the need to release the cpu is present in all OSes which allow 
> multitaskingm
> not just event driven programs.
> 
> I write this because I don't understand why one must litter the code 
> with
> doEvent() calls. I've never had to do this with GUI programming in 
> Linux.
> (In fact, aside from sleep(), Linux seems to not even HAVE a doEvents() 
> equivelent,
> tho I haven't looked very hard for one.)
> 
> I know that doEvents() comes from Win 3.1, which was a cooperative OS, 
> but
> why do more modern Windoze OSes need it?
> 
> Very curious,
> jbrown

The problem is that Euphoria is not multi-threaded rather than in OS. 
While we are doing a longer computation  (ie not returning from event 
handler in win32lib), we cannot call ?GetNextMessage? (forgot the actual 
function name) and Windows are stacking up events in application queue. 
But Windows require the application to handle the event. For example, if 
you move a window, WM_MOVE message is issued, but until your application 
process the message, the window is not actually moved (the application 
may say it cannot be moved). The OS could possibly have timeouts for 
events, and do default processing after timeout, but you would loose a 
lot of user's actions when high CPU load or application being busy.

If we had at least two threads, win32lib would set up separate thread 
just to handle window events, but the way it is we must call doEvents() 
occasionaly in longer code to handle event queue.

    Martin

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu