On Sat, 2008-03-01 at 10:51 +0100, Dirk Meyer wrote:
> +def synchronized(lock=threading.Lock()):

With this, all functions decorated with synchronized will use the same
lock.

@synchronized()
def foo(): ...

@synchronized()
def bar(): ...

Ideally this code should allow foo() and bar() to execute in parallel,
but it doesn't.  Sure you could create a separate mutex for foo() and
pass it to its synchronized() decorator, but that sucks.

Also, I think threading.RLock() should be used, to allow reentrancy in
the same thread.  Or perhaps have a bool kwarg 'reentrant' for this.


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Freevo-devel mailing list
Freevo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freevo-devel

Reply via email to