[Twisted-Python] timers

Eric Hsu nkeric at gmail.com
Wed Jul 20 22:53:27 EDT 2005

2005/7/21, Andrzej Leszczynski <leszczynscy at yahoo.com>:
> Hi folks,
> short question, I implement a very custom statefull
> protocol which need to have some timers in it. Can
> someone point me to examples how to do that?

I've written a ResourceManager which check frequently and release
resources if necessary, may the following code snippet helpful to you

from twisted.internet import task
class ResourceManager:
    def __init__(self):
        interval = 5                     # check every 5 seconds
        releaser = task.LoopingCall(self._releaseResources)

    def _releaseResource(self):

More information about the Twisted-Python mailing list