aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/tools/python/src/Python/thread_pthread.h
diff options
context:
space:
mode:
authorshadchin <shadchin@yandex-team.com>2024-06-13 19:29:50 +0300
committershadchin <shadchin@yandex-team.com>2024-06-13 19:51:47 +0300
commit9051e2318afc1bfbd88a103f7392e622aa8c9527 (patch)
tree5c63ea23ebd5e7b7b9864903a9312aa853193ca5 /contrib/tools/python/src/Python/thread_pthread.h
parent224da250178b9250c7577a167d44f94f732d3627 (diff)
downloadydb-9051e2318afc1bfbd88a103f7392e622aa8c9527.tar.gz
Update Python from 2.7.16 to 2.7.18
2a151e9cf2ebdfa59d250c1bbb800e908703a6f0
Diffstat (limited to 'contrib/tools/python/src/Python/thread_pthread.h')
-rw-r--r--contrib/tools/python/src/Python/thread_pthread.h15
1 files changed, 9 insertions, 6 deletions
diff --git a/contrib/tools/python/src/Python/thread_pthread.h b/contrib/tools/python/src/Python/thread_pthread.h
index 6d4b3b389f..4d792a123a 100644
--- a/contrib/tools/python/src/Python/thread_pthread.h
+++ b/contrib/tools/python/src/Python/thread_pthread.h
@@ -430,12 +430,15 @@ PyThread_free_lock(PyThread_type_lock lock)
(void) error; /* silence unused-but-set-variable warning */
dprintf(("PyThread_free_lock(%p) called\n", lock));
- status = pthread_mutex_destroy( &thelock->mut );
- CHECK_STATUS("pthread_mutex_destroy");
-
+ /* some pthread-like implementations tie the mutex to the cond
+ * and must have the cond destroyed first.
+ */
status = pthread_cond_destroy( &thelock->lock_released );
CHECK_STATUS("pthread_cond_destroy");
+ status = pthread_mutex_destroy( &thelock->mut );
+ CHECK_STATUS("pthread_mutex_destroy");
+
free((void *)thelock);
}
@@ -497,12 +500,12 @@ PyThread_release_lock(PyThread_type_lock lock)
thelock->locked = 0;
- status = pthread_mutex_unlock( &thelock->mut );
- CHECK_STATUS("pthread_mutex_unlock[3]");
-
/* wake up someone (anyone, if any) waiting on the lock */
status = pthread_cond_signal( &thelock->lock_released );
CHECK_STATUS("pthread_cond_signal");
+
+ status = pthread_mutex_unlock( &thelock->mut );
+ CHECK_STATUS("pthread_mutex_unlock[3]");
}
#endif /* USE_SEMAPHORES */