From 93dbbeaa6dc3d34f6619c06c60537e3c0b14ab73 Mon Sep 17 00:00:00 2001 From: fgerlits Date: Fri, 1 Dec 2006 17:49:48 +0000 Subject: [PATCH] possible fix for the scheduler bug --- .../eventScheduler/src/SchedulerThread.cxx | 15 ++++++++++----- .../modules/eventScheduler/src/SchedulerThread.h | 6 ++++++ 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/campcaster/src/modules/eventScheduler/src/SchedulerThread.cxx b/campcaster/src/modules/eventScheduler/src/SchedulerThread.cxx index 2ce67f221..3e5cef87f 100644 --- a/campcaster/src/modules/eventScheduler/src/SchedulerThread.cxx +++ b/campcaster/src/modules/eventScheduler/src/SchedulerThread.cxx @@ -62,12 +62,12 @@ SchedulerThread :: SchedulerThread( Ptr::Ref eventContainer, Ptr::Ref granularity) throw () + : eventContainer(eventContainer), + granularity(granularity), + shouldRun(false), + isPreloading(false) { //DEBUG_FUNC_INFO - - this->eventContainer = eventContainer; - this->granularity = granularity; - this->shouldRun = false; } @@ -113,6 +113,7 @@ SchedulerThread :: nextStep(Ptr::Ref now) throw () std::cerr << "event initialization error: " << e.what() << std::endl; } + isPreloading = true; } else if (imminent(now, nextEventTime)) { Ptr::Ref timeLeft(new time_duration(*nextEventTime - *now)); @@ -122,6 +123,7 @@ SchedulerThread :: nextStep(Ptr::Ref now) throw () currentEvent = nextEvent; currentEventEnd = nextEventEnd; getNextEvent(TimeConversion::now()); + isPreloading = false; } } @@ -132,6 +134,7 @@ SchedulerThread :: nextStep(Ptr::Ref now) throw () currentEvent->stop(); currentEvent->deInitialize(); currentEvent.reset(); + isPreloading = false; debug() << "::nextStep() - End [" << *TimeConversion::now() << "]" << endl; } } @@ -176,7 +179,9 @@ SchedulerThread :: signal(int signalId) throw () switch (signalId) { case UpdateSignal: - getNextEvent(TimeConversion::now()); + if (!isPreloading) { + getNextEvent(TimeConversion::now()); + } break; default: diff --git a/campcaster/src/modules/eventScheduler/src/SchedulerThread.h b/campcaster/src/modules/eventScheduler/src/SchedulerThread.h index eab9cdfcc..ca3a65163 100644 --- a/campcaster/src/modules/eventScheduler/src/SchedulerThread.h +++ b/campcaster/src/modules/eventScheduler/src/SchedulerThread.h @@ -127,6 +127,12 @@ class SchedulerThread : public virtual RunnableInterface */ bool shouldRun; + /** + * Flag indicating that we are between an initialize() and + * a start() call. + */ + bool isPreloading; + /** * Default constructor. */