[experimental] gui/components/cc_frm_clock: use a mutex around unsetting/evaluating paintClock. This may or may not help with the clock-still-showing-when-leaving-the-channellist problem. Pretty much untested, as that issue is quite irreproducible.

This commit is contained in:
martii
2014-04-08 21:19:51 +02:00
committed by [CST] Focus
parent 13118c1148
commit 1c39a6edf4
2 changed files with 14 additions and 16 deletions

View File

@@ -260,24 +260,14 @@ void* CComponentsFrmClock::initClockThread(void *arg)
pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS,0);
CComponentsFrmClock *clock = static_cast<CComponentsFrmClock*>(arg);
#if 0
time_t count = time(0);
#endif
//start loop for paint
while(clock != NULL) {
if (clock->paintClock) {
while (true) {
clock->mutex.lock();
if (clock->paintClock)
clock->paint(CC_SAVE_SCREEN_NO);
#if 0
count = time(0);
#endif
}
#if 0 // memory leak, thread will not be joined --martii
if (time(0) >= count+30) {
clock->cl_thread = 0;
break;
}
#endif
mySleep(clock->cl_interval);
clock->mutex.unlock();
int interval = clock->cl_interval;
mySleep(interval);
}
return 0;
}
@@ -336,7 +326,9 @@ bool CComponentsFrmClock::Stop()
{
if (!activeClock)
return false;
mutex.lock();
paintClock = false;
mutex.unlock();
return cl_thread == 0 ? false : true;
}