diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2010-09-13 14:16:46 +0000 |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2010-09-13 14:16:46 +0000 |
commit | 64b32a2e48eecce58447ae9f0c678464720eb960 (patch) | |
tree | f10b752b6e1ccb5c2d566ce0c2f8395e56e1ee9e /Python/ceval.c | |
parent | eda372fa5744b71b6b43c810ac0f4f0e88e2d3c6 (diff) | |
download | cpython-64b32a2e48eecce58447ae9f0c678464720eb960.tar.gz |
Issue #9828: Destroy the GIL in Py_Finalize(), so that it gets properly
re-created on a subsequent call to Py_Initialize(). The problem (a crash)
wouldn't appear in 3.1 or 2.7 where the GIL's structure is more trivial.
Diffstat (limited to 'Python/ceval.c')
-rw-r--r-- | Python/ceval.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index a181ca83fe..48b5678652 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -313,6 +313,15 @@ PyEval_InitThreads(void) } void +_PyEval_FiniThreads(void) +{ + if (!gil_created()) + return; + destroy_gil(); + assert(!gil_created()); +} + +void PyEval_AcquireLock(void) { PyThreadState *tstate = PyThreadState_GET(); @@ -368,10 +377,6 @@ PyEval_ReInitThreads(void) if (!gil_created()) return; - /*XXX Can't use PyThread_free_lock here because it does too - much error-checking. Doing this cleanly would require - adding a new function to each thread_*.h. Instead, just - create a new lock and waste a little bit of memory */ recreate_gil(); pending_lock = PyThread_allocate_lock(); take_gil(tstate); |