void WatcherThread::waitForStarted() { MutexLocker locker(&mutex); if (flags & Start) return; do { waiter.wait(&mutex); } while (!(flags & Start)); }
void BBLogReplayThread::loop() { if (__logfile->has_next()) { // check if there is time left to wait __now.stamp(); __loopdiff = __now - __last_loop; if ((__offsetdiff.in_sec() - __loopdiff.in_sec()) > __cfg_grace_period) { if (__cfg_non_blocking) { // need to keep waiting before posting, but in non-blocking mode // just wait for next loop return; } else { __waittime = __offsetdiff - __loopdiff; __waittime.wait(); } } __interface->write(); __logfile->read_next(); __last_loop.stamp(); __offsetdiff = __logfile->entry_offset() - __last_offset; __last_offset = __logfile->entry_offset(); } else { if(__cfg_loop_replay){ logger->log_info(name(), "replay finished, looping"); __logfile->rewind(); } else { if (opmode() == OPMODE_CONTINUOUS) { // block logger->log_info(name(), "replay finished, sleeping"); WaitCondition waitcond; waitcond.wait(); } // else wait will just run once per loop } } }