dvfs api and toolkits

Avery Pennarun apenwarr at nit.ca
Mon Apr 4 04:34:01 EEST 2005


On Sun, Apr 03, 2005 at 09:20:41PM -0400, Owen Taylor wrote:

> On Sun, 2005-04-03 at 18:37 -0400, Sean Middleditch wrote:
> 
> > It is entirely possible to build a synchronous wrapper around an
> > asynchronous API, but not the other way around.  The method to do so is
> > basically along the lines of: begin operation, set callback in toolkit
> > event loop, run toolkit loop, check if operation is complete, repeat
> > loop if not complete.  The most important bit here is the toolkit part -
> > doing a synchronous API is dependent on the toolkit (or, more
> > accurately, the event loop) of the application.
> 
> A synchronous API *must not* recurse the main loop.

I'm pretty sure that's not true of all toolkits.  In some, for example,
dialog boxes are implemented by explicitly calling the event loop after
blocking certain kinds of events.

Anyway, I think Sean's point is that the synchronous wrapper has to be
toolkit specific, while the async one doesn't particularly.  So if your
favourite toolkit (gtk, I assume :)) can't handle recursive calls to the
mainloop, just implement the synchronous wrapper using some appropriate
technique.

Have fun,

Avery



More information about the xdg mailing list