|
Barracuda Application Server C/C++ Reference
NO
|
Timer manager used for one-shot and periodic callbacks.
BaTimer runs its own worker thread. Timer callbacks are therefore not executed in the HTTP request thread that created the timer.
#include <BaTimer.h>

Public Member Functions | |
| BaTimer (ThreadMutex *mutex, int stackSize, U32 ticklen=10, ThreadPriority priority=ThreadPrioNormal, AllocatorIntf *alloc=0) | |
| Create a BaTimer object and its worker thread. More... | |
| ~BaTimer () | |
| Terminate the timer. | |
| size_t | set (BaTimer_CB cb, void *data, U32 milliSec) |
| Create a timer event. More... | |
| int | reset (size_t tkey, U32 milliSec) |
| Resets the timer. More... | |
| int | cancel (size_t tkey) |
| Cancels the timer. More... | |
Public Member Functions inherited from Thread | |
| Thread (Thread_Run r, ThreadPriority priority, int stackSize) | |
| Create a thread. More... | |
| void | start () |
| Start the thread. | |
Additional Inherited Members | |
Static Public Member Functions inherited from Thread | |
| static void | sleep (unsigned int milliseconds) |
| Suspend the current thread for n milliseconds. | |
| BaTimer::BaTimer | ( | ThreadMutex * | mutex, |
| int | stackSize, | ||
| U32 | ticklen = 10, |
||
| ThreadPriority | priority = ThreadPrioNormal, |
||
| AllocatorIntf * | alloc = 0 |
||
| ) |
Create a BaTimer object and its worker thread.
| mutex | Mutex shared with the server dispatcher. |
| stackSize | Worker thread stack size in bytes. |
| ticklen | Timer tick interval in milliseconds. |
| priority | Worker thread priority. |
| alloc | Optional allocator used for timer nodes. |
| int BaTimer::cancel | ( | size_t | tkey | ) |
Cancels the timer.
| tkey | the timer key. |
| int BaTimer::reset | ( | size_t | tkey, |
| U32 | milliSec | ||
| ) |
Resets the timer.
| tkey | the timer key. |
| milliSec | the new timeout. The timer is reset from the time this method is called. |
| size_t BaTimer::set | ( | BaTimer_CB | cb, |
| void * | data, | ||
| U32 | milliSec | ||
| ) |
Create a timer event.
| cb | the timer event function. |
| data | transparent data passed to the event callback. |
| milliSec | the timer callback function is activated in "millisecs" time, unless method "reset" or "cancelled" is called before the timer triggers. The callback runs in the timer thread, not in the web-server request thread. |