summaryrefslogtreecommitdiffstats
path: root/Python/ceval_gil.h
diff options
context:
space:
mode:
authorKristján Valur Jónsson <kristjan@ccpgames.com>2012-06-05 22:17:42 (GMT)
committerKristján Valur Jónsson <kristjan@ccpgames.com>2012-06-05 22:17:42 (GMT)
commit187aa545165d8d5eac222ecce29c8a77e0282dd4 (patch)
treebd115faeedc479c9e125f8f4202c28ecc2d3e1f7 /Python/ceval_gil.h
parent902274e9483fb1e179f128b0d5eaafdcae4a4798 (diff)
downloadcpython-187aa545165d8d5eac222ecce29c8a77e0282dd4.zip
cpython-187aa545165d8d5eac222ecce29c8a77e0282dd4.tar.gz
cpython-187aa545165d8d5eac222ecce29c8a77e0282dd4.tar.bz2
Signal condition variables with the mutex held. Destroy condition variables
before their mutexes.
Diffstat (limited to 'Python/ceval_gil.h')
-rw-r--r--Python/ceval_gil.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/Python/ceval_gil.h b/Python/ceval_gil.h
index bf7a350..e7764f2 100644
--- a/Python/ceval_gil.h
+++ b/Python/ceval_gil.h
@@ -313,13 +313,14 @@ static void create_gil(void)
static void destroy_gil(void)
{
- MUTEX_FINI(gil_mutex);
-#ifdef FORCE_SWITCHING
- MUTEX_FINI(switch_mutex);
-#endif
+ /* some pthread-like implementations tie the mutex to the cond
+ * and must have the cond destroyed first.
+ */
COND_FINI(gil_cond);
+ MUTEX_FINI(gil_mutex);
#ifdef FORCE_SWITCHING
COND_FINI(switch_cond);
+ MUTEX_FINI(switch_mutex);
#endif
_Py_atomic_store_explicit(&gil_locked, -1, _Py_memory_order_release);
_Py_ANNOTATE_RWLOCK_DESTROY(&gil_locked);