NAME
OTK_Dispatcher -
Dispatcher which knows about UNIX events and TK.
SYNOPSIS
#include <OTK/dispatch/dispatch.hh>
class OTK_Dispatcher : public OTC_Dispatcher
{
public:
friend class OTK_DispatcherDummy;
static void initialise();
static int dispatch(int theActions=0);
};
CLASS TYPE
Static
DESCRIPTION
OTK_Dispatcher is a version of the standard dispatcher which
adds support for UNIX event sources and is also TK aware. These
event sources are, alarms, timers, signals and events on file
descriptors. Jobs registered directly with the standard dispatcher
will only be executed when there are no pending alarms or timers,
and no events pending on file descriptors. These jobs are given
the name of idle jobs. When the idle jobs registered with the
standard dispatcher are run, they will all be processed once,
before returning to look for pending timers and events on file
descriptors. Signal and alarm events will always preempt idle
jobs. Once the signal and alarm events have been serviced,
returning of idle jobs will commence again, until all the idle
jobs registered at the start of the phase have been returned. Idle
jobs registered while processing current idle jobs, will not be
processed until the next time through the idle job queue.
INITIALISATION
static void initialise();
Initialises the dispatcher so that it
will recognise the UNIX event sources
as well as the TK event dispatcher.
This function must be called before
and idle jobs are registered with the
standard dispatcher, and before the
standard dispatcher is run or attempts to
dispatch a single job using the
dispatch() function of this class.
DISPATCH
static int dispatch(int theActions=0);
Dispatches a single job according to the
flags set in theActions. The default for
theActions is 0, which results in all
events sources being checked, and if
necessary cause the function to block. If
non zero, theActions should be the OR'ed
value of the flags defined by the
enumerated type OUX_JobActions. The
flags can be used to return a job for a
specific event source, or cause the
function not to block. Asking for a single
idle job to be executed will result in all
idle jobs having to be executed before
timer and events on file descriptors will
once again be checked. If a job is
executed, then 1 is returned. If there
were no jobs, or the function
would have blocked when it had been
directed not to, then 0 is returned.
NOTES
This class is kept for backwards compatability only. To initialise
the dispatcher so that it is aware of UNIX real time events and TK,
use:
OTK_JobQueue* queue;
queue = new OTK_JobQueue;
OTC_Dispatcher::initialise(queue);
OTC_Dispatcher::run();
If you need to dispatch a single job, use:
((OTK_JobQueue*)OTC_Dispatcher::queue())->dispatch();
SEE ALSO
OTK_JobQueue, OUX_JobQueue
LIBRARY
OTK
AUTHOR(S)
Graham Dumpleton
COPYRIGHT
Copyright 1993 TELSTRA CORPORATION LIMITED
Copyright 1994 DUMPLETON SOFTWARE CONSULTING PTY LIMITED