|
Barracuda Application Server C/C++ Reference
Native APIs, integration guides, and platform interfaces
|
Classes | |
| struct | HttpCmdThreadPool |
| An instance of this class provides a thread pool to an instance of the HttpServer class. More... | |
| struct | ThreadLock |
| This class provides an easy and less error-prone way of locking and releasing a mutex. More... | |
| struct | ThreadReleaseLock |
| This class provides an easy and less error-prone way of temporarily releasing a locked mutex. More... | |
| struct | ThreadMutex |
| A mutual exclusion class. More... | |
| struct | ThreadSemaphore |
| A simple semaphore implementation. More... | |
| struct | Thread |
| A simple thread class. More... | |
Typedefs | |
| typedef struct HttpCmdThreadPool | HttpCmdThreadPool |
| An instance of this class provides a thread pool to an instance of the HttpServer class. More... | |
| typedef void(* | Thread_Run) (struct Thread *th) |
| Entry point invoked in the new thread after Thread::start. More... | |
Enumerations | |
| enum | ThreadPriority |
| Portable priority choices, mapped to the target operating system. More... | |
Functions | |
| BA_API void | HttpCmdThreadPool_constructor (HttpCmdThreadPool *o, HttpServer *server, ThreadPriority priority, int stackSize) |
| Create workers and bind the pool to a server. More... | |
| BA_API void | HttpCmdThreadPool_destructor (HttpCmdThreadPool *o) |
| Wait for worker completion and detach the pool. More... | |
| HttpCmdThreadPool::HttpCmdThreadPool (HttpServer *server, ThreadPriority priority, int stackSize) | |
| Create an instance of HttpCmdThreadPool and bind the thread pool to an instance of the HttpServer class. More... | |
| HttpCmdThreadPool::~HttpCmdThreadPool () | |
| Terminates all threads in the thread pool and deregisters the thread pool in the HttpServer instance. More... | |
| ThreadLock::ThreadLock (ThreadMutex &m) | |
| Acquire the mutex until scope exit. More... | |
| ThreadLock::ThreadLock (ThreadMutex *m) | |
| Acquire the mutex until scope exit. More... | |
| ThreadLock::~ThreadLock () | |
| Unlock the mutex. More... | |
| ThreadReleaseLock::ThreadReleaseLock (struct HttpRequest *req) | |
| Temporarily release the owned mutex; reacquire at scope exit. More... | |
| ThreadReleaseLock::ThreadReleaseLock (ThreadMutex &m) | |
| Temporarily release the owned mutex; reacquire at scope exit. More... | |
| ThreadReleaseLock::ThreadReleaseLock (ThreadMutex *m) | |
| Temporarily release the owned mutex; reacquire at scope exit. More... | |
| ThreadReleaseLock::ThreadReleaseLock (ThreadLock &tl) | |
| Temporarily release the owned mutex; reacquire at scope exit. More... | |
| ThreadReleaseLock::ThreadReleaseLock (ThreadLock *tl) | |
| Temporarily release the owned mutex; reacquire at scope exit. More... | |
| ThreadReleaseLock::~ThreadReleaseLock () | |
| Reacquire the same mutex before leaving scope. More... | |
| typedef struct HttpCmdThreadPool HttpCmdThreadPool |
An instance of this class provides a thread pool to an instance of the HttpServer class.
An instance of this class creates N threads where N is identical to the value set with method HttpServerConfig::setNoOfHttpCommands.
See the Http Command Thread Pool documentation for more information.
| typedef void(* Thread_Run) (struct Thread *th) |
Entry point invoked in the new thread after Thread::start.
| [in,out] | th | Borrowed originating Thread object, valid until execution has finished. Returning finishes the entry point; it does not free th. The dispatcher mutex is not automatically held on entry. |
| enum ThreadPriority |
Portable priority choices, mapped to the target operating system.
Actual scheduling policy and supported priority differences are port-specific. You can set 1 of 5 priorities: ThreadPrioLowest, ThreadPrioLow, ThreadPrioNormal, ThreadPrioHigh and ThreadPrioHighest
| HttpCmdThreadPool::HttpCmdThreadPool | ( | HttpServer * | server, |
| ThreadPriority | priority, | ||
| int | stackSize | ||
| ) |
Create an instance of HttpCmdThreadPool and bind the thread pool to an instance of the HttpServer class.
The constructor creates N threads, where N is set identical to the number of HttpCommand instances in the HttpServer object. See HttpServerConfig::setNoOfHttpCommands for more information.
The constructor returns no status. Platform thread creation failures use the Thread implementation's error handling. The worker array must be allocated successfully for the pool to serve requests.
| server | Required initialized server, retained by the pool. Keep it alive until after the pool is destroyed. |
| priority | ThreadPriority used for every worker. |
| stackSize | Stack size in bytes for each worker, subject to the target Thread implementation requirements. |
| BA_API void HttpCmdThreadPool_constructor | ( | HttpCmdThreadPool * | o, |
| HttpServer * | server, | ||
| ThreadPriority | priority, | ||
| int | stackSize | ||
| ) |
Create workers and bind the pool to a server.
| [out] | o | Caller-owned pool object. |
| [in,out] | server | Required initialized server that outlives the pool. |
| [in] | priority | ThreadPriority for each worker. |
| [in] | stackSize | Per-worker stack size in bytes. No recoverable construction status is returned. |
| BA_API void HttpCmdThreadPool_destructor | ( | HttpCmdThreadPool * | o | ) |
Wait for worker completion and detach the pool.
| [in,out] | o | Initialized pool, destroyed before its server. The caller must hold the dispatcher mutex; it is released and reacquired while waiting. Do not call from one of this pool's workers. |
| ThreadLock::ThreadLock | ( | ThreadMutex & | m | ) |
Acquire the mutex until scope exit.
| [in,out] | m | Borrowed initialized mutex, valid for the lock lifetime. |
| ThreadLock::ThreadLock | ( | ThreadMutex * | m | ) |
Acquire the mutex until scope exit.
| [in,out] | m | Required non-NULL borrowed initialized mutex. |
| ThreadReleaseLock::ThreadReleaseLock | ( | struct HttpRequest * | req | ) |
Temporarily release the owned mutex; reacquire at scope exit.
| [in,out] | req | Required live request whose dispatcher mutex the current thread owns. |
| ThreadReleaseLock::ThreadReleaseLock | ( | ThreadLock & | tl | ) |
Temporarily release the owned mutex; reacquire at scope exit.
| [in,out] | tl | Borrowed active lock object, valid until this release guard ends. |
| ThreadReleaseLock::ThreadReleaseLock | ( | ThreadLock * | tl | ) |
Temporarily release the owned mutex; reacquire at scope exit.
| [in,out] | tl | Required non-NULL active lock object, valid until this guard ends. |
| ThreadReleaseLock::ThreadReleaseLock | ( | ThreadMutex & | m | ) |
Temporarily release the owned mutex; reacquire at scope exit.
| [in,out] | m | Borrowed initialized mutex currently owned by this thread. |
| ThreadReleaseLock::ThreadReleaseLock | ( | ThreadMutex * | m | ) |
Temporarily release the owned mutex; reacquire at scope exit.
| [in,out] | m | Required non-NULL initialized mutex owned by this thread. |
| HttpCmdThreadPool::~HttpCmdThreadPool | ( | ) |
Terminates all threads in the thread pool and deregisters the thread pool in the HttpServer instance.
Make sure you run this destructor before you terminate the HttpServer instance. Please note that calling this destructor may take considerable time as the destructor must wait for all threads to complete.
The dispatcher must be locked prior to calling the destructor. See the Dispatcher Mutex for more information.
| ThreadLock::~ThreadLock | ( | ) |
Unlock the mutex.
| ThreadReleaseLock::~ThreadReleaseLock | ( | ) |
Reacquire the same mutex before leaving scope.
Do not copy this guard.