multithreading

Peter Hansen peter at engcorp.com
Mon May 20 13:04:57 EDT 2002


François Pinard wrote:
> 
> [Aahz]
> 
> > In article <87sn4n6gz9.fsf at kursk.kassube.de>,
> > Nils Kassube  <nika at kassube.de> wrote:
> 
> > >Multithreading is a very big stability risk if you don't know exactly
> > >what you are doing, i.e. most programmers most of the time.
> 
> > Depends what you're trying to do.
> 
> Multi-threading has been very welcome in some of my projects.  However, I'm
> rather uncomfortable about precisely knowing whether various Python usages
> are atomic or not, and which parts of the Python library are thread-safe.
> Someone once suggested: "Try, and you will see!".  The fact that something
> works never proves it is correct, nor that it will always work.  Short of
> precise documentation on these things, I feel a bit lost when I observe lack
> of stability.  So I sometimes abuse of this thread-off option in my things.

Nothing is atomic except sending messages to a Queue.  At least, if you start 
with that premise you probably can't go wrong...

In what types of applications have you observed instability, and can you
describe the types of thread interaction you were using?  Maybe it would
be instructive for beginners to learn alternative, known-clean approaches
to solving the same problems.

-Peter



More information about the Python-list mailing list