summaryrefslogtreecommitdiff
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 +0000
committerKristj?n Valur J?nsson <kristjan@ccpgames.com>2012-06-05 22:17:42 +0000
commit8bfa3df4bcf0163ddbae0557227e73c4ff4eef09 (patch)
tree06ea31e52ea9328e31db2901ae00ef29e358a4f6 /Python/ceval_gil.h
parenta3f597145efb7bf83193f2b1d6568c43fb09873a (diff)
downloadcpython-8bfa3df4bcf0163ddbae0557227e73c4ff4eef09.tar.gz
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 bf7a350791..e7764f293a 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);