re-add mutex_unlock after pthread_cond_wait,
[enigma2.git] / lib / gdi / grc.cpp
index de6761e810d4f0f335a4f338c95489c6e9339e53..35626a9357b44be96e86063ab6d0a9c3077717e7 100644 (file)
@@ -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
                }
        }