indexworkerthread
Defined in header file: workerthread.hh
Description
\brief This abstract class is part of the daemon framework.
When a scheduler accepts an incoming connection it starts a workerthread
which, as usual, reads some data from the socket, performs some action
on the data and sends a result back. These steps should done in the
pure virtual method dowork() which has to be implemented by derived
classes.
A workerthread provides the following protected attributes:
- _conf - A pointer to the scheduler's instance of the class
config.
- _log - A pointer to an instance of the class logging.
- _sock - File descriptor of the incoming socket.
- _id - A unique identifier for this workerthread. This may
be useful for logging to identify the logging workerthread
Public base classes
LAIR::thread
Constructors
| Constructor |
Description |
| workerthread() |
\brief Constructor. |
Members
| Types |
Description |
| Methods |
|
virtual void
dowork()
= 0
|
\brief Pure virtual method. This method has to be implemented by derived classes and is called by the scheduler when a connection has been accepted and a valid file descriptor for the socket has been be created. Data can be read and written to the socket by using this file descriptor directly or by using the tcp class. After all work is done the file descriptor has to be closed in this method, otherwise the scheduler will run out of file descriptors. |
index