[Zope] Locks?
Stuart 'Zen' Bishop
zen@cs.rmit.edu.au
Thu, 11 Nov 1999 14:47:24 +1100 (EST)
On Thu, 11 Nov 1999, Benno Rice wrote:
> I've got a situation where I'd like to be able to have a mutex lock.
> Unfortunately, I can't use Lock objects out of the thread module as they
> appear to be unpicklable.
>
> Does Zope have any mutex objects I can use?
If you have your lock as a module level variable, I believe it will
work. Either have all instances sharing the same lock or store a dictionary
of locks. This should be fine unless you need to maintain a lock between
Zope restarts in which case your lock could be any object with a known id
in a folder (as only one thread can create the object, and the others fail),
and delete it to unlock.
___
// Zen (alias Stuart Bishop) Work: zen@cs.rmit.edu.au
// E N Senior Systems Alchemist Play: zen@shangri-la.dropbear.id.au
//__ Computer Science, RMIT WWW: http://www.cs.rmit.edu.au/~zen