mirror of
https://github.com/python/cpython.git
synced 2025-07-07 11:25:30 +00:00
gh-135641: Fix flaky test_capi.test_lock_two_threads
test case (gh-135642)
The mutex may have the `_Py_HAS_PARKED` bit set.
This commit is contained in:
parent
46c60e0d0b
commit
17ac3933c3
1 changed files with 4 additions and 1 deletions
|
@ -57,7 +57,10 @@ lock_thread(void *arg)
|
|||
_Py_atomic_store_int(&test_data->started, 1);
|
||||
|
||||
PyMutex_Lock(m);
|
||||
assert(m->_bits == 1);
|
||||
// gh-135641: in rare cases the lock may still have `_Py_HAS_PARKED` set
|
||||
// (m->_bits == 3) due to bucket collisions in the parking lot hash table
|
||||
// between this mutex and the `test_data.done` event.
|
||||
assert(m->_bits == 1 || m->_bits == 3);
|
||||
|
||||
PyMutex_Unlock(m);
|
||||
assert(m->_bits == 0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue