Skip to content

Commit 662a751

Browse files
committed
docs: address review comments on PyMutex docs
- Improve wording around line 38 - Remove redundant note on line 46 - Clarify unlock error behavior on line 55 - Remove duplicate note on PyMutex_Lock
1 parent a5679f6 commit 662a751

1 file changed

Lines changed: 4 additions & 10 deletions

File tree

Doc/c-api/synchronization.rst

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,24 +35,18 @@ The C-API provides a basic mutual exclusion lock.
3535

3636
.. c:function:: void PyMutex_Lock(PyMutex *m)
3737
38-
Lock mutex *m*. If another thread has already locked it, the calling
39-
thread will block until the mutex is unlocked. While blocked, the thread
38+
Lock mutex *m*. If the mutex is already locked, the calling
39+
thread will block until the mutex is unlocked. While blocked, the thread
4040
will temporarily detach the :term:`thread state <attached thread state>` if one exists.
4141
42-
.. warning::
43-
44-
This function will deadlock if the calling thread already holds the lock.
45-
:c:type:`!PyMutex` is not re-entrant. For re-entrant locking, use
46-
:c:func:`Py_BEGIN_CRITICAL_SECTION` instead.
47-
4842
.. versionadded:: 3.13
4943
5044
.. c:function:: void PyMutex_Unlock(PyMutex *m)
5145
5246
Unlock mutex *m*. The mutex must be locked by the calling thread ---
5347
otherwise, the function will issue a fatal error. Unlocking a mutex from
54-
a different thread than the one that locked it results in undefined
55-
behavior.
48+
a different thread than the one that locked it also results in a fatal
49+
error.
5650
5751
.. versionadded:: 3.13
5852

0 commit comments

Comments
 (0)