void AnimePlayer::run() { vector<IImageProvider*>::iterator i; IImageProvider* provider; ISurface* surface; if (anime != NULL) { while (running) { i = anime->begin(); while (i != anime->end()) { provider = *i; surface = prepareSurface(provider); if (win != NULL) { win->renderFrom(surface); } delete surface; surface = NULL; ::usleep(dur); ++i; if (!running) { unlockConditionSatisfied(); return; } } } } unlockConditionSatisfied(); }
void NominalEventMonitor::stopMonitor() { stopped = true; if (running) { running = false; if (isInfinity(expectedSleepTime) || paused) { unlockConditionSatisfied(); } else { wakeUp(); } } }
NominalEventMonitor::~NominalEventMonitor() { deleting = true; running = false; stopped = true; wakeUp(); unlockConditionSatisfied(); lock(); this->player = NULL; this->executionObject = NULL; unlock(); }
void NominalEventMonitor::stopMonitor() { stopped = true; if (timeBaseProvider != NULL) { timeBaseProvider->removeTimeListener(timeBaseId, this); timeBaseProvider->removeIdListener(this); } if (running) { running = false; if (isInfinity(expectedSleepTime) || paused) { unlockConditionSatisfied(); } else { wakeUp(); } } }
Thread::~Thread() { wakeUp(); pthread_cond_signal(&threadFlagConditionVariable); pthread_cond_destroy(&threadFlagConditionVariable); unlockConditionSatisfied(); pthread_cond_signal(&threadFlagCVLockUntilSignal); pthread_cond_destroy(&threadFlagCVLockUntilSignal); pthread_mutex_unlock(&threadMutex); pthread_mutex_destroy(&threadMutex); pthread_mutex_unlock(&threadFlagMutex); pthread_mutex_destroy(&threadFlagMutex); pthread_mutex_unlock(&threadFlagMutexLockUntilSignal); pthread_mutex_destroy(&threadFlagMutexLockUntilSignal); pthread_attr_destroy(&tattr); }
void NominalEventMonitor::resumeMonitor() { if (!isInfinity(expectedSleepTime) && paused) { paused = false; unlockConditionSatisfied(); } }