Timers
Rogue Wave® Server manages timers. Timers are used to postpone an action to a future date. Rogue Wave Server allows you to post a timer that will be fired a given number of seconds after it has been installed. See the Rogue Wave Views Script class IlsTimer.
Timers are assigned to a user function which is triggered when the timer is fired. Timers are managed by an internal thread. There are two cases:
When the application uses the MvTCP communication layer, a message is sent to the main loop when a timer is fired. The user function is called from the main thread as a result of processing of this message.
When timers are used without the MvTCP communication layer being initialized, the user function is triggered by the internal thread and it is your responsibility to manage synchronization.
Example
To install a timer that triggers the user function OnTime every 10 seconds, use the following code:
void
OnTime(IlsTimer& t, IlsAny arg)
{
IlsInfo() << "Timer is triggered..." << IlsEOM;
}
main(int argc, char* argv[]) {
...
IlsTcpMvProcess::Initialize(argc, argv);
IlsTimer* t = new IlsTimer(10, 0, OnTimer);
t->runOnce(IlsFalse);
t->start();
...
}
Important: The timer feature can be used only with the multithread libraries. Moereover, they should be used only after initialization of the MvTCP communication layer. If you want to use them with another communication layer, you should provide a specific IlsTimerManager class to integrate with the communication mainloop. See the classes IlsTimerManager and IlsTimerManagerFactory. |
Version 6.3
Copyright © 2018, Rogue Wave Software, Inc. All Rights Reserved.