From: Andreas Monzner Date: Mon, 3 Apr 2006 20:15:25 +0000 (+0000) Subject: do unlock thread before send signal X-Git-Tag: 2.6.0~3726 X-Git-Url: https://git.cweiske.de/enigma2.git/commitdiff_plain/3d9a041b1ae9244499a5fd54a62d5c6d755d98b7 do unlock thread before send signal --- diff --git a/lib/gdi/grc.cpp b/lib/gdi/grc.cpp index b8426192..de6761e8 100644 --- a/lib/gdi/grc.cpp +++ b/lib/gdi/grc.cpp @@ -63,8 +63,7 @@ void gRC::submit(const gOpcode &o) #ifndef SYNC_PAINT pthread_mutex_lock(&mutex); #endif - int tmp=wp; - tmp+=1; + int tmp=wp+1; if ( tmp == MAXSIZE ) tmp=0; if ( tmp == rp ) @@ -85,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 @@ -109,8 +108,7 @@ void *gRC::thread() pthread_mutex_lock(&mutex); if ( rp != wp ) { - gOpcode o(queue[rp]); - rp++; + gOpcode o(queue[rp++]); if ( rp == MAXSIZE ) rp=0; pthread_mutex_unlock(&mutex);