Barracuda Application Server C/C++ Reference
NO
BaTimer Struct Reference

Detailed Description

The timer class makes it possible to create events that are activated at regular intervals or to create events that are activated only one time.

#include <BaTimer.h>

Inheritance diagram for BaTimer:

Public Member Functions

 BaTimer (ThreadMutex *mutex, int stackSize, U32 ticklen=10, ThreadPriority priority=ThreadPrioNormal, AllocatorIntf *alloc=0)
 Create a BaTimer object and one 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.
 

Constructor & Destructor Documentation

◆ BaTimer()

BaTimer::BaTimer ( ThreadMutex mutex,
int  stackSize,
U32  ticklen = 10,
ThreadPriority  priority = ThreadPrioNormal,
AllocatorIntf alloc = 0 
)

Create a BaTimer object and one thread.

Parameters
mutex
stackSize
ticklen
priority
alloc

Member Function Documentation

◆ cancel()

int BaTimer::cancel ( size_t  tkey)

Cancels the timer.

Parameters
tkeythe timer key. web-server callback i.e. called from another thread.

◆ reset()

int BaTimer::reset ( size_t  tkey,
U32  milliSec 
)

Resets the timer.

Parameters
tkeythe timer key.
milliSecthe new timeout. web-server callback i.e. called from another thread.

◆ set()

size_t BaTimer::set ( BaTimer_CB  cb,
void *  data,
U32  milliSec 
)

Create a timer event.

Parameters
cbthe timer event function.
datatransparent data passed to the event callback.
milliSecthe timer callback function is activated in "millisecs" time, unless method "reset" or "cancelled" is called before the timer triggers. web-server callback i.e. called from another thread.
Returns
the timer key.