[Python-checkins] CVS: python/dist/src/Python pystate.c

Guido van Rossum guido@CNRI.Reston.VA.US
Fri, 18 Jun 1999 11:54:56 -0400


Resending -- this bounced due to an unknown glitch...

--Guido van Rossum (home page: http://www.python.org/~guido/)

Update of /projects/cvsroot/python/dist/src/Python
In directory eric:/projects/python/develop/guido/src/Python

Modified Files:
	pystate.c 
Log Message:
CRITICAL PATCH!

We occasionally received reports from people getting "invalid tstate"
crashes (this is a fatal error in PyThreadState_Delete()).  Finally
several people were able to reproduce it reliably and Tim Peters
discovered that there is a race condition when multiple threads are
calling this function without holding the global interpreter lock (the
function may be called without holding that).

Solved the race condition by adding a lock around the mutating uses of
interp->tstate_head.  Tim and Jonathan Giddy have run tests that make
it likely that this fixes the crashes -- although Tim hasn't heard
from the person who reported the original problem.