gtk multithreaded apps and glib signals
- From: "Brian J. Tarricone" <bjt23 cornell edu>
- To: gtk-app-devel-list gnome org
- Subject: gtk multithreaded apps and glib signals
- Date: Sat, 10 Jul 2004 20:31:28 -0400
hi all-
i'm getting a bit confused as to what i'm supposed to do to make sure
multithreaded gtk apps don't do evil things. i'm writing a music player
(which is a GObject), and the audio decoding and output are handled in a
separate thread (let's call this "thread #2"). when an audio stream
finishes playing, i want it to send a glib signal ("stream-ended").
obviously, thread #2 is what knows about the stream ending, and so
logically it will call g_signal_emit(). do the signal handlers get
called in thread #2, or in the main thread? if in thread #2, i assume i
have to surround any gtk calls in the signal handler with
gdk_threads_enter/leave(), correct?
if the signals are handled in thread #2, is there a way to have the
signal get handled in the main thread? perhaps using g_idle_add() or
g_timeout_add()? in that case, do i still nead the
gdk_threads_enter/leave() pair?
i'm just trying to figure out the best way to do this; any suggestions
would be appreciated.
thanks,
brian
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]