Skip to content

Commit 49a4fa3

Browse files
committed
Updated according to review
1 parent a0bc324 commit 49a4fa3

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

Doc/howto/free-threading-extensions.rst

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -398,19 +398,15 @@ critical section API** (:c:macro:`Py_BEGIN_CRITICAL_SECTION` /
398398

399399
Do **not** lock ``ob_mutex`` directly with ``PyMutex_Lock(&obj->ob_mutex)``.
400400
Mixing direct ``PyMutex_Lock`` calls with the critical section API on the
401-
same mutex can cause deadlocks, because the critical section implementation
402-
may suspend and release its locks when contention is detected.
401+
same mutex can cause deadlocks.
403402

404403
Even if your own code never uses critical sections on a particular object type,
405404
**CPython internals may use the critical section API on any Python object**.
406-
For example, the garbage collector or other interpreter internals may enter a
407-
critical section on your object. If your code holds ``ob_mutex`` directly at
408-
that point, a deadlock can occur.
409405

410406
If your extension type needs its own lock, add a separate :c:type:`PyMutex`
411407
field (or another synchronization primitive) to your object struct.
412-
:c:type:`PyMutex` is very lightweight — it is only one byte — so there is
413-
negligible cost to having an additional one.
408+
:c:type:`PyMutex` is very lightweight, so there is negligible cost to having
409+
an additional one.
414410

415411

416412
Building Extensions for the Free-Threaded Build

0 commit comments

Comments
 (0)