Ian Main <imain / gtk.org> wrote:
> >  * Toolkit must provides select substitution API such as
> >    g_main_set_poll_func().  I don't know that other toolkits than
> >    GTK provide one.
> 
> and g_timeout_add for sleep () etc. right ?  This is what I was thinking.

Hmm...
We probably think a bit differently.

I have no intention of using g_timeout_add().  In my approach,
Ruby scheduler is dominant and GTK mainloop is a Ruby thread.  So
there is no need of telling timeout to GTK.

Brief description of my proposal:

 * Implement a poll_func using rb_thread_select().  The poll_func
   provides the same facility as select().

 * Register the poll_func to GTK by g_main_set_poll_func().
   Then enter GTK mainloop.

 * When GTK mainloop invokes the poll_func, the poll_func calls
   rb_thread_select() and the control comes back to Ruby
   scheduler.


Masaki Fukushima