multithreading

Aahz aahz at pythoncraft.com
Mon May 20 14:37:07 EDT 2002


In article <mailman.1021906534.16414.python-list at python.org>,
=?iso-8859-1?q?Fran=E7ois?= Pinard <pinard at iro.umontreal.ca> 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.

My response is that instead of trying to take advantage of the few
atomic Python constructs, instead code defensively and always use
thread-safe mechanisms for passing information.  Because Python has a
powerful and simple Queue, this is straightforward to accomplish.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"In the end, outside of spy agencies, people are far too trusting and
willing to help."  --Ira Winkler



More information about the Python-list mailing list