From 6e072aff91b3a8d4e0f880c661f4c41a594e6c8a Mon Sep 17 00:00:00 2001 From: Andreas Monzner Date: Mon, 3 Apr 2006 20:49:58 +0000 Subject: [PATCH] re-add mutex_unlock after pthread_cond_wait, add missing #ifdefs --- lib/gdi/grc.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/gdi/grc.cpp b/lib/gdi/grc.cpp index de6761e8..35626a93 100644 --- a/lib/gdi/grc.cpp +++ b/lib/gdi/grc.cpp @@ -84,10 +84,10 @@ void gRC::submit(const gOpcode &o) queue[wp++]=o; if ( wp == MAXSIZE ) wp = 0; - pthread_mutex_unlock(&mutex); if (o.opcode==gOpcode::flush||o.opcode==gOpcode::shutdown||o.opcode==gOpcode::notify) #ifndef SYNC_PAINT pthread_cond_signal(&cond); // wakeup gdi thread + pthread_mutex_unlock(&mutex); #else thread(); // paint #endif @@ -105,13 +105,17 @@ void *gRC::thread() while (rp != wp) { #endif +#ifndef SYNC_PAINT pthread_mutex_lock(&mutex); +#endif if ( rp != wp ) { gOpcode o(queue[rp++]); if ( rp == MAXSIZE ) rp=0; +#ifndef SYNC_PAINT pthread_mutex_unlock(&mutex); +#endif if (o.opcode==gOpcode::shutdown) break; else if (o.opcode==gOpcode::notify) @@ -128,6 +132,7 @@ void *gRC::thread() } #ifndef SYNC_PAINT pthread_cond_wait(&cond, &mutex); + pthread_mutex_unlock(&mutex); #endif } } -- 2.30.2