[Python-Dev] Re: 2.4a2, and @decorators (original) (raw)
Kevin Jacobs jacobs at theopalgroup.com
Wed Aug 4 18:35:56 CEST 2004
- Previous message: [Python-Dev] Re: 2.4a2, and @decorators
- Next message: [Python-Dev] Re: 2.4a2, and @decorators
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Phillip J. Eby wrote:
At 06:09 PM 8/4/04 +0200, Heiko Wundram wrote:
class x: synchronized = threading.Synchronizer()
@synchronized def y(self): When's threading.Synchronizer coming (just a threading.(R)Lock with an extra call which prepares a method for synchronization with this lock)? I already have some patches which implement module/class/instance locking using just a simple RLock and the decorator syntax, and I'd gladly sign over the patches to the PSF. ;) Note that your example, if I understand it correctly, creates a single lock for all instances of class 'x', rather than for individual instances of 'x'. This is not what I'd normally expect from a 'synchronized' method.
Indeed it would, if implemented as described. However, one could use the same syntax and implement a Synchronizer that implemented locks at the instance level. Dirty tricks would be involved, but it is possible. (If I ever get some free time, I will take a stab at doing it, too. Sounds like a good cookbook recipe)
-Kevin
- Previous message: [Python-Dev] Re: 2.4a2, and @decorators
- Next message: [Python-Dev] Re: 2.4a2, and @decorators
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]