diff options
| author | Andreas Monzner <andreas.monzner@multimedia-labs.de> | 2006-04-03 14:02:26 +0000 |
|---|---|---|
| committer | Andreas Monzner <andreas.monzner@multimedia-labs.de> | 2006-04-03 14:02:26 +0000 |
| commit | 37fdc6163ad2a672f42b7836e68461e851263cb9 (patch) | |
| tree | 9232401b2c985fbf04f3c41dfa1fa47e2dadb599 /lib | |
| parent | 9808383ef39f0d038f0c1cbd629e8020613d49a7 (diff) | |
| download | enigma2-37fdc6163ad2a672f42b7836e68461e851263cb9.tar.gz enigma2-37fdc6163ad2a672f42b7836e68461e851263cb9.zip | |
fix thread locking
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/gdi/grc.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/gdi/grc.cpp b/lib/gdi/grc.cpp index d1380953..e4e4a861 100644 --- a/lib/gdi/grc.cpp +++ b/lib/gdi/grc.cpp @@ -102,23 +102,24 @@ void *gRC::thread() #ifndef SYNC_PAINT while (1) { - singleLock s(mutex); #else while (rp != wp) { #endif + pthread_mutex_lock(&mutex); if ( rp != wp ) { - gOpcode& o(queue[rp]); + gOpcode o(queue[rp]); + rp++; + if ( rp == MAXSIZE ) + rp=0; + pthread_mutex_unlock(&mutex); 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 { @@ -130,6 +131,7 @@ void *gRC::thread() #ifndef SYNC_PAINT pthread_cond_wait(&cond, &mutex); #endif + pthread_mutex_unlock(&mutex); } } #ifndef SYNC_PAINT |
