RfD: Automagically making a class instance 'synchronized' (draft impl.)

Gerhard Häring gh_pythonlist at gmx.de
Wed Jun 12 01:37:40 CEST 2002


* holger krekel <pyth at devel.trillke.net> [2002-06-12 00:04 +0200]:
> Gerhard Häring wrote:
> > For one of my projects, I'll need something not quite unlike the
> > following code. It's not tested, yet, but it looks ok and complete to
> > me. I thought that it could be useful to other developers who need to
> > use multithreading, so I'm posting it here. Maybe something like this
> > would even be a useful addition to the Standard Library?
> 
> note that Ian Kjos some weeks ago send a nice module 'morethreading.py'
> to the dev-list. IIRC, it still waits for beeing reviewed and extended
> with other ideas (like synchronized methods). 

Sounds interesting, I'll have a look at it. I also just found this
recipe: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65202
which has a few more interesting additions. It's possible to do without
my methodlist, for example.

> [...] this can be safely substituted and then even returns the correct value<wink> with
> try: ... finally:

Whoops. I missed that originally, thanks.

Btw. I've only recently started to seriously experiment with
multithreading. Have you read my recent post

Message-ID: <slrnafpeei.p8.gerhard at developer2.opus-gmbh.net>
with the title "Need advice on multithreading problem"

? I find it really nifty. It's about wrapping a C library function that
uses callbacks to Python generators. I'd welcome any comments on the
approach I've taken there (Queue.Queue, a deferred producer thread with
the generator in the main thread being the consumer).

Unfortunately, this opened a whole can of worms, which I think I solved
now. Now I'm trying to solve them more elegantly.

If anybody wants to try this out in real life, it's in the PySQLite CVS
as the alternative IterCursor implementation.

Gerhard
-- 
This sig powered by Python!
Außentemperatur in München: 14.7 °C      Wind: 2.6 m/s





More information about the Python-list mailing list