|
21 | 21 | #include "pycore_import.h" // _PyImport_AcquireLock() |
22 | 22 | #include "pycore_initconfig.h" // _PyStatus_EXCEPTION() |
23 | 23 | #include "pycore_jit_unwind.h" // _Py_jit_debug_mutex |
24 | | -#include "pycore_lock.h" // _PyMutex_LockTimed() |
| 24 | +#include "pycore_lock.h" // PyMutex_LockFast() |
25 | 25 | #include "pycore_long.h" // _PyLong_IsNegative() |
26 | 26 | #include "pycore_moduleobject.h" // _PyModule_GetState() |
27 | 27 | #include "pycore_object.h" // _PyObject_LookupSpecial() |
@@ -16977,7 +16977,7 @@ ScandirIterator_closedir(ScandirIterator *iterator) |
16977 | 16977 | HANDLE handle = INVALID_HANDLE_VALUE; |
16978 | 16978 |
|
16979 | 16979 | _Py_atomic_store_uint8(&iterator->closed, 1); |
16980 | | - if (_PyMutex_LockTimed(&iterator->read_mutex, 0, 0) == PY_LOCK_ACQUIRED) { |
| 16980 | + if (PyMutex_LockFast(&iterator->read_mutex)) { |
16981 | 16981 | // no reads in progress, we can close the handle |
16982 | 16982 | handle = iterator->handle; |
16983 | 16983 | iterator->handle = INVALID_HANDLE_VALUE; |
@@ -17066,7 +17066,7 @@ ScandirIterator_closedir(ScandirIterator *iterator) |
17066 | 17066 | DIR *dirp = NULL; |
17067 | 17067 |
|
17068 | 17068 | _Py_atomic_store_uint8(&iterator->closed, 1); |
17069 | | - if (_PyMutex_LockTimed(&iterator->read_mutex, 0, 0) == PY_LOCK_ACQUIRED) { |
| 17069 | + if (PyMutex_LockFast(&iterator->read_mutex)) { |
17070 | 17070 | // no reads in progress, we can close dirp |
17071 | 17071 | dirp = iterator->dirp; |
17072 | 17072 | iterator->dirp = NULL; |
|
0 commit comments