AddTimer

The AddTimer virtual method creates a single-shot or repeating timer.

Virtual Method Synopsis

AddTimer($timerVal, $tag, $isRepeat)

Parameters

$timerVal
Specifies the time interval, in milliseconds, between timer events.
$tag
Specifies the tag to be appended to "USER_".
$isRepeat
Specifies the type of timer to create. The value 0 (zero) creates a single-shot timer and the value 1 creates a repeating timer.

Description

The AddIimer virtual method:

  • Creates a single-shot or repeating timer, depending on the value passed to the $isRepeat parameter. The value of the $timerVal parameter specifies the interval, in milliseconds, between the timer events.
  • Appends the tag specified in the $tag parameter to "USER_". The timer events are returned to the Perl application as "USER_$tag" messages through a call to the RIV::GetResult function.

Example Usage

The following example assumes a previous call to the RIV::App constructor, which returns a client/server application object to $app. A call could also be made to the RIV::Agent constructor, which returns a discovery agent application object (typically, to $agent).

$ok = $app->AddTimer(100, "TIMER", 1);

Returns

Upon completion, the AddTimer virtual method returns:

  • 0 (zero) — The attempt to create a single-shot or repeating timer was unsuccessful.
  • 1 — The attempt to create a single-shot or repeating timer was successful.

See Also