Barracuda Application Server C/C++ Reference
NO
|
The SoDisp dispatches any socket connection that contains data by calling the SoDispCon::execute member function in a SoDispCon object.
This class contains the socket dispatcher loop which waits for data on all registered socket connections. A socket connection is stored in a SoDispCon object, and the dispatcher object dispatches the socket connection by calling SoDispCon::execute.
The SoDisp class is platform dependent and may be implemented differently for various operating systems. The "generic SoDisp" is using "socket select" and waits in a loop for the next active socket connection.
#include <SoDisp.h>
Public Member Functions | |
SoDisp (ThreadMutex *mutex) | |
The constructor. More... | |
void | mutexSet () |
Lock the dispatcher thread. More... | |
void | mutexRelease () |
Releases the mutex if this is the last 'pop'. More... | |
ThreadMutex * | getMutex () |
Returns the SoDisp mutex. | |
void | setExit () |
The callbacks can force the dispatcher to exit the run method. | |
void | run (S32 timeout=-1) |
Call the socket dispatcher loop, which dispatches HTTP requests. More... | |
SoDisp::SoDisp | ( | ThreadMutex * | mutex | ) |
The constructor.
mutex | is protecting the web-server code. |
void SoDisp::mutexRelease | ( | ) |
Releases the mutex if this is the last 'pop'.
Releases the mutex set with function SoDisp::mutexSet.
void SoDisp::mutexSet | ( | ) |
Lock the dispatcher thread.
This function protects the web-server with a mutex and makes it possible for threads to call functions in the web-server. One mutexSet call must be followed by one HttpServer::mutexRelease call.
void SoDisp::run | ( | S32 | timeout = -1 | ) |
Call the socket dispatcher loop, which dispatches HTTP requests.
The default argument for C++ is to set timeout=-1, which makes the function block, i.e. never return. C code must always provide an argument, which is normally -1. The function can be used with a polled-based system by setting the timeout value.
This method is used with the generic dispatcher.