[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Idea for an event loop library
- From: Marc Balmer <marc@...>
- Date: Fri, 11 May 2012 09:23:47 +0200
Am 09.05.12 18:15, schrieb Michal Kottman:
> On 9 May 2012 13:22, Rob Hoelz <email@example.com> wrote:
>> So let's say I wanted to print 'hello' a second after a user
>> clicked a button in a GUI. I could do something like this:
>> -- this assumes that the GUI plays nicely with the event loop
>> print 'hi'
>> and other events would continue to fire while the button handler is
> This should be doable with Qt. The proposed library should provide a
> generic way for other libraries to "register themselves" onto the
> event loop using a "step" function to query/handle a single/few
> In Qt you would implement this step function using
> QCoreLibrary::processEvents(QEventLoop::AllEvents) to handle GUI
> events and give back control to the event library, so that it could
> process other stuff, such as networking. You can even specify a
> timeout which you are willing to wait, like "spend max 100ms
> processing Qt events" -
> QCoreLibrary::processEvents(QEventLoop::AllEvents, 100).
fwiw, LuaMotif supports Xt and this Timeouts (and all other event types
that X11 supports). I think I even added a timeuout.lua example on github.