gh-111178: Fix function signatures to fix undefined behavior (#131191)

This commit is contained in:
Victor Stinner 2025-03-14 10:52:15 +01:00 committed by GitHub
parent e4ac196aaa
commit a5776639c8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 28 additions and 20 deletions

View file

@ -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)) {