added event update functionality to the event scheduler
This commit is contained in:
parent
70a8e75020
commit
d58414c65e
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: maroy $
|
||||
Version : $Revision: 1.1 $
|
||||
Version : $Revision: 1.2 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/eventScheduler/include/LiveSupport/EventScheduler/EventScheduler.h,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -67,7 +67,7 @@ using namespace LiveSupport::Core;
|
|||
* A generic event scheduler, for non-everlapping subsequent events.
|
||||
*
|
||||
* @author $Author: maroy $
|
||||
* @version $Revision: 1.1 $
|
||||
* @version $Revision: 1.2 $
|
||||
*/
|
||||
class EventScheduler
|
||||
{
|
||||
|
@ -112,6 +112,14 @@ class EventScheduler
|
|||
virtual void
|
||||
start(void) throw ();
|
||||
|
||||
/**
|
||||
* Forces the scheduler to re-read its event container.
|
||||
* Call this if the events held in the event container have
|
||||
* changed.
|
||||
*/
|
||||
virtual void
|
||||
update(void) throw ();
|
||||
|
||||
/**
|
||||
* Stop the event scheduler.
|
||||
*/
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: maroy $
|
||||
Version : $Revision: 1.1 $
|
||||
Version : $Revision: 1.2 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/eventScheduler/src/EventScheduler.cxx,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -76,6 +76,16 @@ LiveSupport::EventScheduler::EventScheduler :: start(void) throw ()
|
|||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Update the events.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
LiveSupport::EventScheduler::EventScheduler :: update(void) throw ()
|
||||
{
|
||||
thread->signal(SchedulerThread::UpdateSignal);
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Stop the event scheduler.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: maroy $
|
||||
Version : $Revision: 1.4 $
|
||||
Version : $Revision: 1.5 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/eventScheduler/src/SchedulerThread.cxx,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -145,3 +145,21 @@ SchedulerThread :: run(void) throw ()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Accept a signal.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
SchedulerThread :: signal(int signalId) throw ()
|
||||
{
|
||||
switch (signalId) {
|
||||
case UpdateSignal:
|
||||
getNextEvent(TimeConversion::now());
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: maroy $
|
||||
Version : $Revision: 1.3 $
|
||||
Version : $Revision: 1.4 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/eventScheduler/src/SchedulerThread.h,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -67,10 +67,18 @@ using namespace LiveSupport::Core;
|
|||
* The main, executing thread of the scheduler.
|
||||
*
|
||||
* @author $Author: maroy $
|
||||
* @version $Revision: 1.3 $
|
||||
* @version $Revision: 1.4 $
|
||||
*/
|
||||
class SchedulerThread : public virtual RunnableInterface
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Enumerated type for the signals accepted by this object.
|
||||
*
|
||||
* @see #signal
|
||||
*/
|
||||
typedef enum { UpdateSignal } SignalTypes;
|
||||
|
||||
private:
|
||||
/**
|
||||
* The event container, to get the events from.
|
||||
|
@ -177,6 +185,20 @@ class SchedulerThread : public virtual RunnableInterface
|
|||
virtual void
|
||||
run(void) throw ();
|
||||
|
||||
/**
|
||||
* Accept a signal.
|
||||
* Currently supported signal values are:
|
||||
* <ul>
|
||||
* <li>UpdateSignal - re-read the event container</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param signalId a value from SignalTypes.
|
||||
* @see #signalTypes
|
||||
*/
|
||||
virtual void
|
||||
signal(int signalId) throw ();
|
||||
|
||||
|
||||
/**
|
||||
* Signal the thread to stop, gracefully.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue