[Zope3-Users] Starting thread in object deserialize

Alek Kowalczyk thealx at poczta.onet.pl
Sun Apr 16 12:47:00 EDT 2006


Hello,

I have an object which needs to be associated with a thread. The thread
should be started on object creation and stopped when object is removed
or zope is stopped. The object is persistent - there is a possibility
that it will be created by both web interface and when starting zope
(deserializing objects).

How to assure that the thread will be properly started on
deserialization, and properly stopped on object removal?
I read through documentation of Events and I suspect I might subscribe
to IObjectCreatedEvent and IObjectRemovedEvent for that.
Or will it be enough just to start thread in __init__ and remove it in
__del__ of the object?

Regards,
Alek




More information about the Zope3-users mailing list