Mercurial > dwindows
diff gtk/dw.c @ 96:baaf4b04d284
Fixed a deadlock when locking a mutex from an event handler on FreeBSD.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Fri, 05 Jul 2002 01:32:37 +0000 |
parents | 7c3eef54c98c |
children | cd0e5cf92f6a |
line wrap: on
line diff
--- a/gtk/dw.c Thu May 30 07:47:28 2002 +0000 +++ b/gtk/dw.c Fri Jul 05 01:32:37 2002 +0000 @@ -4309,7 +4309,17 @@ */ void dw_mutex_lock(HMTX mutex) { + /* If we are being called from an event handler we must release + * the GTK mutex so we don't deadlock. + */ + if(pthread_self() == _dw_thread) + gdk_threads_leave(); + pthread_mutex_lock(&mutex); + + /* And of course relock it when we have acquired the mutext */ + if(pthread_self() == _dw_thread) + gdk_threads_enter(); } /*