Re: [gtk-list] Threading and glib main



On Wed, 19 Jan 2000 02:26:54 +0100, Kai Wetzel wrote:
> I was thinking of using a seperate mainloop for another thread
> when I realized (read in the reference manual) that the glib
> main loop is global.  I'd mainly like to watch for input on
> some fds in a thread which is not the one where the GUI stuff is
> beeing handled, with as little effort as possible.
> 
> I had the following alternative ideas:
> 
> - handling read-ready on the X fd is done in another thread, not
>   the thread calling select.  So all Gtk works would just
>   be done there on default, including calls to XSync.  Is there a
>   way to do this with a (few) call(s) ?
> 
> - use one seperate thread for running the select loop (custom,
>   not glib) for the other fds.  While a little more work than
>   the other idea, could Gtk+ live with this and would I just need
>   to call g_main_wakeup or set an idle handler to "notify" the
>   main thread carrying select ?

Why don't you just use gdk_input_add() to watch for the input? No need for
threading.


Erik

-- 
J.A.K. (Erik) Mouw, Information and Communication Theory Group, Department
of Electrical Engineering, Faculty of Information Technology and Systems,
Delft University of Technology, PO BOX 5031,  2600 GA Delft, The Netherlands
Phone: +31-15-2785859  Fax: +31-15-2781843  Email J.A.K.Mouw@its.tudelft.nl
WWW: http://www-ict.its.tudelft.nl/~erik/





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