indexsched
Defined in header file: sched.hh
Description

The class sched is the scheduler of the daemon framework and listens on a
given port for incoming tcp requests. As soon as a tcp request has been
received it will be accepted and the appropriate socket is given to an
idle workerthread. If all workerthreads are busy at this time the scheduler
waits until a workerthread becomes idle. No further connections are accepted
during this time.
The scheduler is an abstract class with the pure virtual method
client()
which is responsible for creating
workerthreads. When
the scheduler is started by calling the method
exec() a pool of
workerthreads is created which will be set into idle state immediately. In
idle state a workerthread does not consume any cpu time.
Public base classes
Constructors
| Constructor |
Description |
| sched(const char* logpath, const char* logfile, int port, int threads = 5) |
Creates a scheduler. |
| sched(const char* logfile, const char* configfile) |
Creates a scheduler which reads its configuration from the given configuration file. |
Members
| Types |
Description |
| Methods |
|
virtual workerthread*
client()
= 0
|
Creates a workerthread. |
|
bool
exec() |
Starts the scheduler. |
|
void
stop() |
Causes the daemon to reject further incoming connections and to quit from exec as soon as all workerthreads have finished. |
|
void
join() |
Blocks the calling process until the daemon has quit. |
|
bool
running() |
Returns true if the scheduler is running and ready to accept connections. |
|
void
set_loglevel(int) |
Sets the log level of the daemon and workerthreads. |
|
config*
get_config() |
Returns a pointer to the configuration. |
|
logging*
get_log() |
Returns a pointer to the logging object. |
index