Re: Glib main loop update



Owen Taylor wrote:
> 
> I sat down this weekend, and did an initial implementation
> of a main loop for GLib.
> 
> There are some differences from what I posted earlier:
> 
>  * It now uses a separate GSource for each timeout, idle,
>    or input function. To keep things relatively efficient
>    for timeouts, the main loop now passes the current
>    time into the prepare() check() and dispatch() functions.
> 
>  * Registration of file events for poll() has been separated
>    out a bit from the GSource API.
> 
>  * I've built the IO watches around a GIOChannel abstraction.
>    (Somewhat different from either tml's current stuff in
>    GLib, and from Josh MacDonald's proposal in the choice
>    of vfuncs. Let me know what needs to be added.)
> 
> The relevant portions of the header file are below. For those who are
> interested, I've put the initial implementation at:
> 
>  ftp://ftp.gtk.org/pub/users/otaylor/gmain.tar.gz
> 
> I've renamed GIOChannel to GIORiver in that tarball so
> it can be compiled with current GTK+. It isn't fully debugged
> yet.

Looks pretty good to me, although I can't say I understand every subtle
detail. Certainly, abstracting over the differences between Unix and
Win32 is a noble goal.

One question I had - when programming with threads, is there a way to
make a condition variable "wake up" the select in the mainloop? I
thought of using a pipe for this, but that seems less than ideal.

Raph



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]