Critical sections and mutexes

David Bolen db3l at fitlinxx.com
Thu Oct 25 17:39:11 EDT 2001


<brueckd at tbye.com> writes:

> The fact that the Python core is inherently thread-safe is a very
> high-level concept, and is a fundamental part of threading support in
> Python. It is completely in line with other housekeeping/safety features
> of Python. That type of basic thread safety will not go away. The GIL
> might, but its replacement would still be a threadsafe core, and so you'd
> end up with the same thing.

Ah, but Python's dynamicism can make it hard to predict when you're
sure that you are executing within the core (say your code is handed a
Python implemented object that just happens to look like a list), or
especially when you can subclass the built-in types in 2.2.  Although
I'd concede that if done right such other objects or subclasses ought
to maintain the same sort of threadsafe contract as the built-in
objects do, but that's harder to guarantee and I'm not sure I'd want
to risk it when writing code for later maintenance.

Not to mention that later updates or maintenance of the code may
introduce other uses that affect what underlying objects are in use as
shared resources, and it would be nice to have the framework in place
to already secure such resources.

--
-- David
-- 
/-----------------------------------------------------------------------\
 \               David Bolen            \   E-mail: db3l at fitlinxx.com  /
  |             FitLinxx, Inc.            \  Phone: (203) 708-5192    |
 /  860 Canal Street, Stamford, CT  06902   \  Fax: (203) 316-5150     \
\-----------------------------------------------------------------------/



More information about the Python-list mailing list