Skip to content

Commit 82a6612

Browse files
committed
Use PyMutex_LockFast().
1 parent 854b5b9 commit 82a6612

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

Modules/posixmodule.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#include "pycore_import.h" // _PyImport_AcquireLock()
2222
#include "pycore_initconfig.h" // _PyStatus_EXCEPTION()
2323
#include "pycore_jit_unwind.h" // _Py_jit_debug_mutex
24-
#include "pycore_lock.h" // _PyMutex_LockTimed()
24+
#include "pycore_lock.h" // PyMutex_LockFast()
2525
#include "pycore_long.h" // _PyLong_IsNegative()
2626
#include "pycore_moduleobject.h" // _PyModule_GetState()
2727
#include "pycore_object.h" // _PyObject_LookupSpecial()
@@ -16977,7 +16977,7 @@ ScandirIterator_closedir(ScandirIterator *iterator)
1697716977
HANDLE handle = INVALID_HANDLE_VALUE;
1697816978

1697916979
_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)) {
1698116981
// no reads in progress, we can close the handle
1698216982
handle = iterator->handle;
1698316983
iterator->handle = INVALID_HANDLE_VALUE;
@@ -17066,7 +17066,7 @@ ScandirIterator_closedir(ScandirIterator *iterator)
1706617066
DIR *dirp = NULL;
1706717067

1706817068
_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)) {
1707017070
// no reads in progress, we can close dirp
1707117071
dirp = iterator->dirp;
1707217072
iterator->dirp = NULL;

0 commit comments

Comments
 (0)