Skip to content

Make ctrl-c interrupt threading.Lock.acquire() on Windows #125541

Description

@colesbury

Feature or enhancement

Since Python 3.2, pressing ctrl-c (SIGINT) interrupts threading.Lock.acquire() on POSIX platforms, including Linux and macOS. However, this does not work on Windows.

Now that threading.Lock and threading.RLock use PyMutex and _PyRecursiveMutex internally, this should be a lot easier to implement efficiently.

See also #125058

cc @pitrou @zooba @gpshead

Linked PRs

Activity

  1. pitrou commented on Oct 15, 2024

    @pitrou
    Member

    You mean here

    wait = WaitForSingleObjectEx(sema->platform_sem, millis, FALSE);
    ?

  2. colesbury commented on Oct 15, 2024

    @colesbury
    ContributorAuthor

    Yes, we can use WaitForMultipleObjectsEx() with _PyOS_SigintEvent() there without performance implications because that is the slow path that's only taken if the thread is about to block.

  3. added 7 commits that reference this issue on Oct 15, 2024
  4. added a commit that references this issue on Oct 17, 2024
  5. added a commit that references this issue on Jan 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions