Re: Work woth GUI from a thread that was made by pthread_createfunction
- From: Soeren Sandmann <sandmann daimi au dk>
- To: "bharat tewari" <bharat tewari wipro com>
- Cc: "iain" <iain ximian com>, "Charles Kerr" <charles rebelbase com>, <gtk-app-devel-list gnome org>, "Pawel Salek" <pawsa theochem kth se>, <admin kiesoft com>, "Michael Meeks" <michael ximian com>, <gnome-devel-list gnome org>
- Subject: Re: Work woth GUI from a thread that was made by pthread_createfunction
- Date: 15 Feb 2002 15:17:07 +0100
"bharat tewari" <bharat tewari wipro com> writes:
> or one of the solution is to make all the ui being handled by one thread
> either through mutex synchronization etc.
If you must use threads, then the solution is indeed to serialise all
access to gdk/gtk+ though the thread that runs the main loop. Any time
you want to call a gdk or gtk function from a thread, do
g_idle_add (function_that_does_it, data_for_function);
the function_that_does_it() can safely call any gdk and gtk+
functions.
(Make sure that that function doesn't block. Ideally it shouldn't run
for more than a few milliseconds; it can return TRUE to have the main
loop call it again when all events have been processed).
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]