[Twisted-Python] timers
Eric Hsu
nkeric at gmail.com
Wed Jul 20 20:53:27 MDT 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
:)
[code]
from twisted.internet import task
class ResourceManager:
def __init__(self):
interval = 5 # check every 5 seconds
releaser = task.LoopingCall(self._releaseResources)
releaser.start(interval)
def _releaseResource(self):
[snip]
...
[/code]
More information about the Twisted-Python
mailing list