Re: Glib main loop update




Raph Levien <raph@acm.org> writes:

> 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.

GTK+ currently uses a pipe for this. (See gdk_threads_wake()).
As far as I know, this is the only way of handling it, since
select() and poll() are separate from the threading system.

With GTK+'s main loop now, because it does this wakeup, if,
in a thread, you want to execute some code in the main loop,
you can do this with:

 gdk_threads_enter();
 gdk_idle_add (func_to_execute, NULL);
 gdk_theads_leave();

Regards,
                                        Owen



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