Classes Files

Wombat::MamaTimer

A repeating timer

Inherits from Wombat.MamaWrapper, IDisposable

Public Functions

  Name
delegate void OnTimerTickDelegate(IntPtr timer, IntPtr closure)
This delegate describes the native callback functions invoked for timer tick and destroy events.
  MamaTimer()
Construct a timer object.
  MamaTimer(IntPtr nativeHandle)
Construct a timer object using a precreated native timer.
void create(MamaQueue queue, MamaTimerCallback action, double interval)
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. A null value for the queue uses the default mama queue.
void create(MamaQueue queue, MamaTimerCallback action, double interval, object 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. A null value for the queue uses the default mama queue.
void destroy()
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. This is functionally equivalent to disposing the instance.
double getInterval()
Get the current timer interval.
void reset()
Reset the timer to the beginning of the interval.
void setInterval(double interval)
Set the timer to use a different interval (and reset to the beginning of that interval).

Protected Functions

  Name
virtual override MamaStatus.mamaStatus DestroyNativePeer()
This will be called by the base class to destroy the native timer. MamaWrapper.DestroyNativePeer

Additional inherited members

Public Functions inherited from Wombat.MamaWrapper

  Name
void Dispose()
Destroys the underlying peer object and unbinds the wrapper from it.
void setNativeHandle(IntPtr nHandle)
Sets the native handle of the native peer object. Should only be used by subclasses and in the same assembly.

Protected Functions inherited from Wombat.MamaWrapper

  Name
  MamaWrapper()
Constructs a new wrapper object but doesn’t create it. If the object is not explicitly disposed it will remain registered for finalization and will attempt the destroy the native peer object when finalized.
  MamaWrapper(IntPtr nativeHandle)
Constructs a managed wrapper from an existing native peer. The peer object will not be automatically finalized
virtual void Dispose(bool disposing, bool destroyNativeHandle =true)
The actual implementation of Dispose - called by both the Dispose method and the finalizer.
virtual void OnDispose()

Protected Attributes inherited from Wombat.MamaWrapper

  Name
IntPtr nativeHandle
the handle to the native peer object

Public Functions Documentation

function OnTimerTickDelegate

delegate void OnTimerTickDelegate(
    IntPtr timer,
    IntPtr closure
)

This delegate describes the native callback functions invoked for timer tick and destroy events.

Parameters:

  • timer The native timer object.
  • closure The closure passed to the timer create function.

function MamaTimer

MamaTimer()

Construct a timer object.

function MamaTimer

MamaTimer(
    IntPtr nativeHandle
)

Construct a timer object using a precreated native timer.

Parameters:

  • nativeHandle The native timer handle.

function create

void create(
    MamaQueue queue,
    MamaTimerCallback action,
    double interval
)

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. A null value for the queue uses the default mama queue.

Parameters:

  • queue The queue from which the timer event will be dispatched.
  • action The callback to be invoked after the interval
  • interval The interval in seconds.

function create

void create(
    MamaQueue queue,
    MamaTimerCallback action,
    double interval,
    object 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. A null value for the queue uses the default mama queue.

Parameters:

  • queue The queue from which the timer event will be dispatched.
  • action The callback to be invoked after the interval
  • interval The interval in seconds.
  • closure Closure data for timer.

function destroy

void destroy()

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. This is functionally equivalent to disposing the instance.

function getInterval

double getInterval()

Get the current timer interval.

Return: The interval in seconds.

function reset

void reset()

Reset the timer to the beginning of the interval.

function setInterval

void setInterval(
    double interval
)

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

Parameters:

  • interval The interval in settings.

Protected Functions Documentation

function DestroyNativePeer

virtual override MamaStatus.mamaStatus DestroyNativePeer()

This will be called by the base class to destroy the native timer. MamaWrapper.DestroyNativePeer

Return: MAMA Status code

Reimplements: Wombat::MamaWrapper::DestroyNativePeer


Updated on 2023-03-31 at 15:29:33 +0100