Skip to content

Commit 4c40381

Browse files
miss-islingtonzuo
andauthored
[3.12] gh-125058: update _thread docs regarding interruptibility of lock.acquire() (GH-125141) (#125307)
gh-125058: update `_thread` docs regarding interruptibility of `lock.acquire()` (GH-125141) (cherry picked from commit 0135848) Co-authored-by: Jan Kaliszewski <[email protected]>
1 parent ee1257c commit 4c40381

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Doc/library/_thread.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,9 +216,11 @@ In addition to these methods, lock objects can also be used via the
216216
* Calling :func:`sys.exit` or raising the :exc:`SystemExit` exception is
217217
equivalent to calling :func:`_thread.exit`.
218218

219-
* It is not possible to interrupt the :meth:`~threading.Lock.acquire` method on
220-
a lock --- the :exc:`KeyboardInterrupt` exception will happen after the lock
221-
has been acquired.
219+
* It is platform-dependent whether the :meth:`~threading.Lock.acquire` method
220+
on a lock can be interrupted (so that the :exc:`KeyboardInterrupt` exception
221+
will happen immediately, rather than only after the lock has been acquired or
222+
the operation has timed out). It can be interrupted on POSIX, but not on
223+
Windows.
222224

223225
* When the main thread exits, it is system defined whether the other threads
224226
survive. On most systems, they are killed without executing

0 commit comments

Comments
 (0)