aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/gdi/grc.cpp7
1 files changed, 6 insertions, 1 deletions
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
}
}