language agnostic - how does a non-blocking event loop work? -


Twisted has a "non-blocked" event loop.

I understand what the blocking event loop does (type, from the Wikipedia page), but can not figure out how a non-intercept does.

Basically, the non-blocking event loop uses the device to wait together for many events ( select / code> publicity on Unix, Stopford multiplay events windows, ipl on Linux kqueue free BSD etc). In each iteration of the main loop, events (file descriptors, timers, etc.) are registered in any kind of handles. Then, a function that waits for events (eg. select ) it usually gives all the events that occurred during the greeting of that function. Finally, loop handles incidents - usually implementing callbacks associated with events.

For details, implement libevent or some GUI toolkit event loop - GTK + or QT.


Comments