Twisted has a “non-blocking” event loop.
I understand what a blocking event loop does (sort of, from the Wikipedia page) but can’t figure out how a non-blocking one does.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Basically, non-blocking event loop utilizes device that allows for waiting for multiple events simultaneously (
select/pollon UNIX,WaitForMultipleEventson Windows,epollon Linuxkqueueon FreeBSD etc). In each iteration of main loop, events (file descriptors, timers etc) are registered in some kind of handle. Then, a function that waits for events (eg.select) is invoked. This typically returns all events that happened during invocation of that function. Finally, loop handles that events – typically by invoking callbacks associated with events.For details, see implementation of libevent or some GUI toolkit event loops – GTK+ or Qt.