Trees | Indices | Help |
|
---|
|
Container class for storing resources which should be cleaned up on close and periodically checked. Use stop_event.set() to stop the internal thread.
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|
Add resources via add(object). They should have a no-arg cleanup() and a check() method. The check method will be called periodically (default: 60 seconds) on each resource. The cleanup method will be called on Resources.cleanup() |
Within a lock, copy the "stuff" list and reverse it. The list is reversed so that entries added later, which may depend on earlier added entries get a chance to be cleaned up first.
|
While stop_event is unset, go through the copy of stuff and call the check method on each entry. Any that throws an exception or returns a False value will be returned in the remove list. |
Finally, within another lock, call the "cleanup" method on all the entries in remove, and remove them from the official stuff list. (If stop_event is set during execution, we return with the assumption that Resources.cleanup() will take care of them)
|
|
|
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Tue Oct 18 13:28:51 2011 | http://epydoc.sourceforge.net |