Mercurial > cpython-lru_cache-weakref
diff Python/ceval.c @ 64709:557e2537c9ae
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.
| author | Antoine Pitrou <solipsis@pitrou.net> |
|---|---|
| date | Mon, 13 Sep 2010 14:16:46 +0000 |
| parents | 1764796e9eca |
| children | c9e299249323 |
line wrap: on
line diff
--- a/Python/ceval.c Mon Sep 13 07:18:30 2010 +0000 +++ b/Python/ceval.c Mon Sep 13 14:16:46 2010 +0000 @@ -313,6 +313,15 @@ } 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 @@ 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);
