[maemo-developers] [maemo-developers] Glib main loop behavior

From: Martin Grimme mgrimme at online.de
Date: Wed Dec 7 15:16:02 EET 2005
Hi,

Am Dienstag, den 06.12.2005, 18:36 +0100 schrieb Samuel Abels:
> The problem is that my_callback_in_the_glib_loop() is only called when
> there is activity on the screen, such as the mouse pointer moving over
> the Xephyr window in the scratchbox environment.

You have to call g_thread_init at the beginning
(see
http://developer.gnome.org/doc/API/2.0/glib/glib-Threads.html#g-thread-init).


> What is the reason for this behaviour, and is there a way around it? I
> would like to use the mechanism to work around Gtk not being thread
> safe.

GTK is not really thread-safe, but if you really have to call GTK
functions from within a thread, you have to place them between
gtk_thread_enter() and gtk_thread_leave() calls and be careful
to not nest these calls.


Regards,
Martin



More information about the maemo-developers mailing list