NAME
OUX_JobQueue -
Job queue which understands UNIX signals, time and I/O events.
SYNOPSIS
#include <OUX/dispatch/jobqueue.hh>
class OUX_JobQueue : public OTC_JobQueue
{
public:
OUX_JobQueue();
~OUX_JobQueue();
OTC_Job* next();
virtual OTC_Job* next(int theAction);
int dispatch(int theAction=0);
};
CLASS TYPE
Concrete
DESCRIPTION
OUX_JobQueue is a derived version of OTC_JobQueue which
understands how to manage signals, alarms, timers and I/O events,
within the UNIX environment.
When the next() member function is invoked to return the
next job to execute, the class first checks for any signals
which may have occurred. If no signals have occurred, a check
is made for any alarms which may have expired. Checks are then
made for normal jobs, and finally a select() or poll() call is
made to check for timer and I/O events.
When a request is made for a specific type of job, the valid
flags which can OR'ed together are:
- OUXLIB_SIGNAL_JOBS
- OUXLIB_ALARM_JOBS
- OUXLIB_TIMEOUT_JOBS
- OUXLIB_IO_JOBS
- OUXLIB_IDLE_JOBS
If OUXLIB_DONT_WAIT is included in the set of flags, the
function will return without executing a job if the function would
have needed to block in order to get a job. The value 0 can be
used to select all event sources, or OUXLIB_DONT_WAIT by itself
if all jobs are to be selected but blocking should not occur.
QUEUEING
OTC_Job* next();
Returns the next job to be executed.
If there are alarms or timers which
have not expired, or file descriptors
being waited upon, this function will
block if necessary.
virtual OTC_Job* next(int theAction);
Returns a job to be executed. The type of
job and whether the function blocks is
determined by theAction. If theAction
is 0, all event sources will be checked
and the function will block if necessary.
If non zero, theAction should be the
OR'ed combination of the flags defined
by the enum OUX_JobActions as described
above.
DISPATCH
int dispatch(int theAction=0);
Dispatches a single job according to the
flags set in theAction. The default for
theAction is 0, which results in all
events sources being checked, and if
necessary cause the function to block. If
non zero, theAction 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.
SEE ALSO
OTC_JobQueue, OTC_Job, OUXEV_Signal, OTCEV_Alarm,
OTCEV_Timeout, OTCEV_IOEvent, OUX_Dispatcher
LIBRARY
OUX
AUTHOR(S)
Graham Dumpleton
COPYRIGHT
Copyright 1993 OTC LIMITED
Copyright 1994 DUMPLETON SOFTWARE CONSULTING PTY LIMITED