Simple thread-safe counter?

Tim Peters tim.peters at gmail.com
Sat Apr 2 17:48:23 EST 2005


[Paul Rubin]
> I'm starting to believe the GIL covers up an awful lot of sloppiness
> in Python.

The GIL is highly exploitable, and much of CPython does exploit it.

If you don't want to exploit it, that's fine:  there was always an
obvious approach using an explicit mutex here, and the only thing
stopping you from using it is a desire to be clever.  Exploiting the
GIL in CPython is clever; using an explicit mutex is utterly
straightforward.  Pick your poison.



More information about the Python-list mailing list