Skip to content

Commit 0135848

Browse files
authored
pythongh-125058: update _thread docs regarding interruptibility of lock.acquire() (python#125141)
1 parent b12e992 commit 0135848

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
@@ -219,9 +219,11 @@ In addition to these methods, lock objects can also be used via the
219219
* Calling :func:`sys.exit` or raising the :exc:`SystemExit` exception is
220220
equivalent to calling :func:`_thread.exit`.
221221

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

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

0 commit comments

Comments
 (0)