Critical sections and mutexes

Chris Tavares christophertavares at earthlink.net
Wed Oct 24 18:43:39 EDT 2001


<brueckd at tbye.com> wrote in message
news:mailman.1003954284.31449.python-list at python.org...
[... snip ...]
> Not necessarily. My point was simply that locking or no was mostly an
> application-level requirement rather than a Python interpreter one. For
> example (back to the producer/consumer example), assume that you have two
> producers and a consumer that toggles between the producer lists called
> 'j' and 'k'.  If 'i' is the consumer's reference to whatever list it's
> currently working on, you don't need any locking around 'i = j' even if
> a producer happens to be modifying j at the "same time". Data won't be
> lost, the interpreter won't die, etc, etc. That's all I was pointing out.
>
[ ...snip... ]

Isn't this relying rather heavily on the implementation of a specific
version of the python interpreter, though? Removing the global interpreter
lock (and these semantics that you're leaning on)  has been the focus of
some serious effort in the past. Does jython share this same behavior? What
about the version with the "free threading patches" from a couple of years
ago?

You're asking for trouble in the long run if you rely on this, I think.

-Chris






More information about the Python-list mailing list