Hi!

While writing Glib::Event, I stumbled over the following problem:

Glib::Event effectively implements a kind of Event::loop. It would be very
natural to actually make it call Event::loop, but there is a catch that
hit me a number of time sin similar circumstances (e.g. in Coro::Event):

Unlike glibs event loop, you cannot exit from a specific
Event::loop. There is Event::unloop, but there is no way to pair unloops
with loops. As such, the parameter to unloop is essentially useless except
in simplistic cases, as you cannot know who will process the return value
from loop.

Example:

  main program calls Event::loop
     callback calls Event:loop
        callback generated by the main program calls unloop
     callback is "surprised" by the value it receives. It has no idea how to 
interpret it.
  main program doesn't get the exit/unloop value.

Glib provides a way to exit a specific main context, and this would be
what I would need: Event::loop, and when any of *my* watchers become
active, exit *my* event loop. If there is a recursive call to Event::loop,
nothing shoul[d happen until that returns.

Now, is there a way to do that in Event? Right now, I have to call
one_event repeatedly, which is not efficient (well, it works for me, as
modern machines became quite fast, but this inefficiency nags me :)

Thanks a lot for any input!

-- 
                The choice of a
      -----==-     _GNU_
      ----==-- _       generation     Marc Lehmann
      ---==---(_)__  __ ____  __      [EMAIL PROTECTED]
      --==---/ / _ \/ // /\ \/ /      http://schmorp.de/
      -=====/_/_//_/\_,_/ /_/\_\      XX11-RIPE

Reply via email to