aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Include/internal/pycore_lock.h
diff options
context:
space:
mode:
Diffstat (limited to 'Include/internal/pycore_lock.h')
-rw-r--r--Include/internal/pycore_lock.h15
1 files changed, 8 insertions, 7 deletions
diff --git a/Include/internal/pycore_lock.h b/Include/internal/pycore_lock.h
index 7484b05d7f2..585120108cf 100644
--- a/Include/internal/pycore_lock.h
+++ b/Include/internal/pycore_lock.h
@@ -25,13 +25,6 @@ PyMutex_LockFast(PyMutex *m)
return _Py_atomic_compare_exchange_uint8(lock_bits, &expected, _Py_LOCKED);
}
-// Checks if the mutex is currently locked.
-static inline int
-PyMutex_IsLocked(PyMutex *m)
-{
- return (_Py_atomic_load_uint8(&m->_bits) & _Py_LOCKED) != 0;
-}
-
// Re-initializes the mutex after a fork to the unlocked state.
static inline void
_PyMutex_at_fork_reinit(PyMutex *m)
@@ -48,6 +41,14 @@ typedef enum _PyLockFlags {
// Handle signals if interrupted while waiting on the lock.
_PY_LOCK_HANDLE_SIGNALS = 2,
+
+ // Fail if interrupted by a signal while waiting on the lock.
+ _PY_FAIL_IF_INTERRUPTED = 4,
+
+ // Locking & unlocking this lock requires attached thread state.
+ // If locking returns PY_LOCK_FAILURE, a Python exception *may* be raised.
+ // (Intended for use with _PY_LOCK_HANDLE_SIGNALS and _PY_LOCK_DETACH.)
+ _PY_LOCK_PYTHONLOCK = 8,
} _PyLockFlags;
// Lock a mutex with an optional timeout and additional options. See