def add_timer(self, callback, when, interval, ident):
''' Add timer to the data structure.
:param callback: Arbitrary callable object.
:type callback: ``callable object``
:param when: The first expiration time, seconds since epoch.
:type when: ``integer``
:param interval: Timer interval, if equals 0, one time timer, otherwise
the timer will be periodically executed
:type interval: ``integer``
:param ident: (optional) Timer identity.
:type ident: ``integer``
:returns: A timer object which should not be manipulated directly by
clients. Used to delete/update the timer
:rtype: ``solnlib.timer_queue.Timer``
'''
timer = Timer(callback, when, interval, ident)
self._timers.add(timer)
return timer
评论列表
文章目录