OpenMAMA
timer.h File Reference
#include <mama/status.h>
#include <mama/types.h>
#include <mama/queue.h>

Go to the source code of this file.

Typedefs

typedef void(MAMACALLTYPE * mamaTimerCb) (mamaTimer timer, void *closure)
 Prototype for callback invoked by timer. More...
 

Functions

MAMAExpDLL mama_status mamaTimer_create (mamaTimer *result, mamaQueue queue, mamaTimerCb action, mama_f64_t interval, void *closure)
 Create a repeating timer. More...
 
MAMAExpDLL mama_status mamaTimer_create2 (mamaTimer *result, mamaQueue queue, mamaTimerCb action, mamaTimerCb onTimerDestroyed, mama_f64_t interval, void *closure)
 Create a repeating timer. More...
 
MAMAExpDLL mama_status mamaTimer_allocate (mamaTimer *result, mamaQueue queue)
 Allocate a repeating timer. More...
 
MAMAExpDLL mama_status mamaTimer_allocate2 (mamaTimer *result, mamaQueue queue, mamaTimerCb onTimerDestroyed)
 Allocate a repeating timer. More...
 
MAMAExpDLL mama_status mamaTimer_start (mamaTimer result, mamaTimerCb action, mama_f64_t interval, void *closure)
 Start a repeating timer created using allocate. More...
 
MAMAExpDLL mama_status mamaTimer_destroy (mamaTimer timer)
 Destroy the timer. More...
 
MAMAExpDLL mama_status mamaTimer_reset (mamaTimer timer)
 Reset the timer to the beginning of the interval. More...
 
MAMAExpDLL mama_status mamaTimer_setInterval (mamaTimer timer, mama_f64_t interval)
 Set the timer to use a different interval (and reset to the beginning of that interval). More...
 
MAMAExpDLL mama_status mamaTimer_getInterval (const mamaTimer timer, mama_f64_t *interval)
 Get the current timer interval. More...
 
MAMAExpDLL mama_status mamaTimer_getQueue (const mamaTimer timer, mamaQueue *queue)
 Return the mamaQueue for this timer. More...
 

Typedef Documentation

typedef void(MAMACALLTYPE * mamaTimerCb) (mamaTimer timer, void *closure)

Prototype for callback invoked by timer.

Parameters
timerThe timer handle.
closureCaller supplied closure.

Function Documentation

MAMAExpDLL mama_status mamaTimer_create ( mamaTimer result,
mamaQueue  queue,
mamaTimerCb  action,
mama_f64_t  interval,
void closure 
)

Create a repeating timer.

Since the mamaTimer relies on the timer mechanism of the underlying middleware, the resolution of the timer is also dependent on the middleware. Consult your middleware documentation for details.

The callback is invoked repeatedly at the specified interval until the timer is destroyed.

Parameters
resultA pointer to the timer handle.
queueThe queue from which the timer event will be dispatched.
actionThe callback to be invoked after the interval.
closureThe closure that is passed to the callback.
intervalThe interval in seconds.
MAMAExpDLL mama_status mamaTimer_create2 ( mamaTimer result,
mamaQueue  queue,
mamaTimerCb  action,
mamaTimerCb  onTimerDestroyed,
mama_f64_t  interval,
void closure 
)

Create a repeating timer.

Since the mamaTimer relies on the timer mechanism of the underlying middleware, the resolution of the timer is also dependent on the middleware. Consult your middleware documentation for details.

The callback is invoked repeatedly at the specified interval until the timer is destroyed.

Parameters
resultA pointer to the timer handle.
queueThe queue from which the timer event will be dispatched.
actionThe callback to be invoked after the interval.
onTimerDestroyedThis callback will be invoked whenever the timer is destroyed, can be NULL.
closureThe closure that is passed to the callback.
intervalThe interval in seconds.
MAMAExpDLL mama_status mamaTimer_allocate ( mamaTimer result,
mamaQueue  queue 
)

Allocate a repeating timer.

Parameters
resultA pointer to the timer handle.
queueThe queue from which the timer event will be dispatched.
MAMAExpDLL mama_status mamaTimer_allocate2 ( mamaTimer result,
mamaQueue  queue,
mamaTimerCb  onTimerDestroyed 
)

Allocate a repeating timer.

Parameters
resultA pointer to the timer handle.
queueThe queue from which the timer event will be dispatched.
onTimerDestroyedCallback will be invoked whenever the timer has been completely destroyed.
MAMAExpDLL mama_status mamaTimer_start ( mamaTimer  result,
mamaTimerCb  action,
mama_f64_t  interval,
void closure 
)

Start a repeating timer created using allocate.

The callback is invoked repeatedly at the specified interval until the timer is destroyed.

Parameters
resultThe timer handle returned from allocate.
queueThe queue from which the timer event will be dispatched.
actionThe callback to be invoked after the interval.
closureThe closure that is passed to the callback.
intervalThe interval in seconds.
MAMAExpDLL mama_status mamaTimer_destroy ( mamaTimer  timer)

Destroy the timer.

This function must be called from the same thread dispatching on the associated event queue unless both the default queue and dispatch queue are not actively dispatching. Note that this function is asynchronous and is only guaranteed to have finished whenever the onTimerDestroyed function passed to the mamaTimer_create2 has been called.

Parameters
timerThe mamaTimer to be destroyed.
MAMAExpDLL mama_status mamaTimer_reset ( mamaTimer  timer)

Reset the timer to the beginning of the interval.

Parameters
timerThe mamaTimer to be reset.
MAMAExpDLL mama_status mamaTimer_setInterval ( mamaTimer  timer,
mama_f64_t  interval 
)

Set the timer to use a different interval (and reset to the beginning of that interval).

Parameters
timerThe mamaTimer to change the interval.
intervalThe new interval for the timer.
MAMAExpDLL mama_status mamaTimer_getInterval ( const mamaTimer  timer,
mama_f64_t interval 
)

Get the current timer interval.

Parameters
timerThe mamaTimer.
intervalAddress of the location where the interval will be written.
MAMAExpDLL mama_status mamaTimer_getQueue ( const mamaTimer  timer,
mamaQueue queue 
)

Return the mamaQueue for this timer.

Parameters
timerThe timer.
queueA pointer to hold the queue.


© 2012 Linux Foundation