mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
gh-111178: Fix function signatures to fix undefined behavior (#131191)
This commit is contained in:
parent
e4ac196aaa
commit
a5776639c8
5 changed files with 28 additions and 20 deletions
|
@ -137,8 +137,10 @@ _PyMutex_LockTimed(PyMutex *m, PyTime_t timeout, _PyLockFlags flags)
|
|||
}
|
||||
|
||||
static void
|
||||
mutex_unpark(PyMutex *m, struct mutex_entry *entry, int has_more_waiters)
|
||||
mutex_unpark(void *arg, void *park_arg, int has_more_waiters)
|
||||
{
|
||||
PyMutex *m = (PyMutex*)arg;
|
||||
struct mutex_entry *entry = (struct mutex_entry*)park_arg;
|
||||
uint8_t v = 0;
|
||||
if (entry) {
|
||||
PyTime_t now;
|
||||
|
@ -168,7 +170,7 @@ _PyMutex_TryUnlock(PyMutex *m)
|
|||
}
|
||||
else if ((v & _Py_HAS_PARKED)) {
|
||||
// wake up a single thread
|
||||
_PyParkingLot_Unpark(&m->_bits, (_Py_unpark_fn_t *)mutex_unpark, m);
|
||||
_PyParkingLot_Unpark(&m->_bits, mutex_unpark, m);
|
||||
return 0;
|
||||
}
|
||||
else if (_Py_atomic_compare_exchange_uint8(&m->_bits, &v, _Py_UNLOCKED)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue