X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/4761063866d8e2112579e88d32e8c2a92af08e57..07d7a4b23312577ccfe7b196169160594ba63601:/lib/gdi/grc.cpp diff --git a/lib/gdi/grc.cpp b/lib/gdi/grc.cpp index d1380953..19a32b62 100644 --- a/lib/gdi/grc.cpp +++ b/lib/gdi/grc.cpp @@ -1,10 +1,4 @@ -// for debugging use: -// #define SYNC_PAINT #include -#ifndef SYNC_PAINT -#include -#endif - #include #include #include @@ -63,8 +57,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 ) @@ -102,23 +95,27 @@ void *gRC::thread() #ifndef SYNC_PAINT while (1) { - singleLock s(mutex); #else while (rp != wp) { +#endif +#ifndef SYNC_PAINT + pthread_mutex_lock(&mutex); #endif if ( rp != wp ) { - gOpcode& o(queue[rp]); + 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) need_notify = 1; else o.dc->exec(&o); - rp++; - if ( rp == MAXSIZE ) - rp=0; } else { @@ -129,6 +126,7 @@ void *gRC::thread() } #ifndef SYNC_PAINT pthread_cond_wait(&cond, &mutex); + pthread_mutex_unlock(&mutex); #endif } }