#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);
};
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:
-IfOUXLIB_SIGNAL_JOBS
-OUXLIB_ALARM_JOBS
-OUXLIB_TIMEOUT_JOBS
-OUXLIB_IO_JOBS
-OUXLIB_IDLE_JOBS
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.
OTC_Job* next();
virtual OTC_Job* next(int theAction);
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.
int dispatch(int theAction=0);
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.
OTC_JobQueue
, OTC_Job
, OUXEV_Signal
, OTCEV_Alarm
,
OTCEV_Timeout
, OTCEV_IOEvent
, OUX_Dispatcher