Re: Threads
- From: Russell Shaw <rjshaw iprimus com au>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: Threads
- Date: Tue, 30 Dec 2003 02:55:38 +1100
Hi,
In a multi-threaded gtk app, i get errors like:
Xlib: unexpected async reply (sequence 0x3170)!
I tried this mutex method to stop non-reentrant gdk things
from being screwed:
void draw(GdkDrawable *drawable, GdkGC *gc, gint32 x, gint32 y, gint size)
{
static GStaticMutex mutex=G_STATIC_MUTEX_INIT;
....
g_static_mutex_lock(&mutex);
gdk_draw_rectangle(drawable,gc,TRUE,x-size/2,y-size/2,size,size);
g_static_mutex_unlock(&mutex);
}
I didn't use gdk_threads_enter()/leave() because this blocks when
it is called from the 'normal' gtk_main thread.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]