]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.7] bpo-39847: EnterNonRecursiveMutex() uses GetTickCount64() (GH-18780) (GH-18959)
authorbobince <and+github@doxdesk.com>
Thu, 12 Mar 2020 14:28:31 +0000 (14:28 +0000)
committerGitHub <noreply@github.com>
Thu, 12 Mar 2020 14:28:31 +0000 (07:28 -0700)
commitfeaf0c37891dfe8f0f3e643c3711af3af23bf805
tree8377bbbbcc9e2d4a96c8bcb15310d8d61f267751
parent6a12676b1910d52c85561bdf4f1e20aa13fc8f46
[3.7] bpo-39847: EnterNonRecursiveMutex() uses GetTickCount64() (GH-18780) (GH-18959)

The 32-bit (49-day) TickCount relied on in EnterNonRecursiveMutex can overflow
in the gap between the 'target' time and the 'now' time WaitForSingleObjectEx
returns, causing the loop to think it needs to wait another 49 days. This is
most likely to happen when the machine is hibernated during
WaitForSingleObjectEx.

This makes acquiring a lock/event/etc from the _thread or threading module
appear to never timeout.

Replace with GetTickCount64 - this is OK now Python no longer supports XP which
lacks it, and is in use for time.monotonic().

Co-authored-by: And Clover <and.clover@bromium.com>
(cherry picked from commit 64838ce)

Co-authored-by: bobince <and+github@doxdesk.com>
Misc/NEWS.d/next/Windows/2020-03-04-17-05-11.bpo-39847.C3N2m3.rst [new file with mode: 0644]
Python/thread_nt.h