Metaclasses, decorators, and synchronization

Michael Ekstrand mekstran at scl.ameslab.gov
Sun Sep 25 23:46:21 EDT 2005


On Sunday 25 September 2005 22:30, Victor Ng wrote:
> You could do it with a metaclass, but I think that's probably
> overkill.

OK. And thanks for the example :-). It looks simple enough... I didn't 
think the solution would be overly complex. And the RLock makes it 
easier than I anticipated - was RLock not in existance when Synch.py 
from the old Python metaclass tutorial/demo was written?

> It's not really efficient as it's doing test/set of an RLock all the
> time, but hey - you didn't ask for efficient.  :)

Hmm... efficient is good. I was planning to do something with some kind 
of lock, but I'm fairly new to multithreaded programming. What would be 
a more efficient way to accomplish this?

- Michael



More information about the Python-list mailing list