The kernel provides a service called TimerManager.

It can be reached in the kernel, namespaces and targets with getTimerManager(). Timers can be set up here, which then send a message to the owner target after the time has elapsed. There are one-time timers that are deleted after the time has elapsed, and there are timers that are sent periodically. The latter must be deleted by the owner when they are no longer needed.

Ordinary timers have only the record ID as payload. If you also want to send data, a record template must be provided when creating the timer. The data in the record will be sent every time.

Timers can be deleted at any time - even before the end of their period. Timers can also be retriggered. The elapsed timer time is reset to zero. Of course, it is also possible to check whether a timer is still running.

Timers are not real-time capable, but that's not their purpose. You should run at least 10ms, because the service doesn't have a higher resolution anyway.

Timers are very useful for handling timeouts, such as responding to disconnections or non-recurring message responses.

If a target is deleted, even though it has pending timers, they are cleared by the system.