-// for debugging use:
-// #define SYNC_PAINT
#include <unistd.h>
-#ifndef SYNC_PAINT
-#include <pthread.h>
-#endif
-
#include <lib/gdi/grc.h>
#include <lib/gdi/font.h>
#include <lib/base/init.h>
#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 )
#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
{
}
#ifndef SYNC_PAINT
pthread_cond_wait(&cond, &mutex);
+ pthread_mutex_unlock(&mutex);
#endif
}
}