<feed xmlns='http://www.w3.org/2005/Atom'>
<title>python.git/Python/thread_nt.h, branch master</title>
<subtitle>Python interpreter</subtitle>
<id>http://dangofactory.net/cgit/cgit.cgi/Server/python.git/atom/Python/thread_nt.h?h=master</id>
<link rel='self' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/atom/Python/thread_nt.h?h=master'/>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/'/>
<updated>2021-12-07T21:03:47Z</updated>
<entry>
<title>bpo-46008: Move thread-related interpreter state into a sub-struct. (gh-29971)</title>
<updated>2021-12-07T21:03:47Z</updated>
<author>
<name>Eric Snow</name>
<email>ericsnowcurrently@gmail.com</email>
</author>
<published>2021-12-07T21:03:47Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=313f92a57bc3887026ec16adb536bb2b7580ce47'/>
<id>urn:sha1:313f92a57bc3887026ec16adb536bb2b7580ce47</id>
<content type='text'>
This parallels _PyRuntimeState.interpreters.  Doing this helps make it more clear what part of PyInterpreterState relates to its threads.

https://bugs.python.org/issue46008</content>
</entry>
<entry>
<title>bpo-41710: Add private _PyDeadline_Get() function (GH-28674)</title>
<updated>2021-10-01T11:29:25Z</updated>
<author>
<name>Victor Stinner</name>
<email>vstinner@python.org</email>
</author>
<published>2021-10-01T11:29:25Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=833fdf126c8fe77fd17e8a8ffbc5c571b3bf64bd'/>
<id>urn:sha1:833fdf126c8fe77fd17e8a8ffbc5c571b3bf64bd</id>
<content type='text'>
Add a private C API for deadlines: add _PyDeadline_Init() and
_PyDeadline_Get() functions.

* Add _PyTime_Add() and _PyTime_Mul() functions which compute t1+t2
  and t1*t2 and clamp the result on overflow.
* _PyTime_MulDiv() now uses _PyTime_Add() and _PyTime_Mul().</content>
</entry>
<entry>
<title>bpo-41710: Fix PY_TIMEOUT_MAX on Windows (GH-28673)</title>
<updated>2021-10-01T11:03:03Z</updated>
<author>
<name>Victor Stinner</name>
<email>vstinner@python.org</email>
</author>
<published>2021-10-01T11:03:03Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=98d282700221234157159df4af76423d89490ad9'/>
<id>urn:sha1:98d282700221234157159df4af76423d89490ad9</id>
<content type='text'>
WaitForSingleObject() accepts timeout in milliseconds in the range
[0; 0xFFFFFFFE] (DWORD type). INFINITE value (0xFFFFFFFF) means no
timeout. 0xFFFFFFFE milliseconds is around 49.7 days.

PY_TIMEOUT_MAX is (0xFFFFFFFE * 1000) milliseconds on Windows, around
49.7 days.

Partially revert commit 37b8294d6295ca12553fd7c98778be71d24f4b24.</content>
</entry>
<entry>
<title>bpo-41710: PyThread_acquire_lock_timed() clamps the timout (GH-28643)</title>
<updated>2021-09-30T08:16:51Z</updated>
<author>
<name>Victor Stinner</name>
<email>vstinner@python.org</email>
</author>
<published>2021-09-30T08:16:51Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=37b8294d6295ca12553fd7c98778be71d24f4b24'/>
<id>urn:sha1:37b8294d6295ca12553fd7c98778be71d24f4b24</id>
<content type='text'>
PyThread_acquire_lock_timed() now clamps the timeout into the
[_PyTime_MIN; _PyTime_MAX] range (_PyTime_t type) if it is too large,
rather than calling Py_FatalError() which aborts the process.

PyThread_acquire_lock_timed() no longer uses
MICROSECONDS_TO_TIMESPEC() to compute sem_timedwait() argument, but
_PyTime_GetSystemClock() and _PyTime_AsTimespec_truncate().

Fix _thread.TIMEOUT_MAX value on Windows: the maximum timeout is
0x7FFFFFFF milliseconds (around 24.9 days), not 0xFFFFFFFF
milliseconds (around 49.7 days).

Set PY_TIMEOUT_MAX to 0x7FFFFFFF milliseconds, rather than 0xFFFFFFFF
milliseconds.

Fix PY_TIMEOUT_MAX overflow test: replace (us &gt;= PY_TIMEOUT_MAX) with
(us &gt; PY_TIMEOUT_MAX).</content>
</entry>
<entry>
<title>bpo-41299: Mark private thread_nt.h functions as static (GH-28553)</title>
<updated>2021-09-24T23:14:09Z</updated>
<author>
<name>Victor Stinner</name>
<email>vstinner@python.org</email>
</author>
<published>2021-09-24T23:14:09Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=6bc89116cb121c176453b9745e3daa2cc5df43ab'/>
<id>urn:sha1:6bc89116cb121c176453b9745e3daa2cc5df43ab</id>
<content type='text'>
Mark the following thread_nt.h functions as static:

* AllocNonRecursiveMutex()
* FreeNonRecursiveMutex()
* EnterNonRecursiveMutex()
* LeaveNonRecursiveMutex()</content>
</entry>
<entry>
<title>bpo-41299: Fix EnterNonRecursiveMutex() (GH-28548)</title>
<updated>2021-09-24T22:40:18Z</updated>
<author>
<name>Victor Stinner</name>
<email>vstinner@python.org</email>
</author>
<published>2021-09-24T22:40:18Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=d639e3170506a1a80c4b2f1b3a6250bb95ff190a'/>
<id>urn:sha1:d639e3170506a1a80c4b2f1b3a6250bb95ff190a</id>
<content type='text'>
Remove Py_FatalError() call: the code works even if now is negative.</content>
</entry>
<entry>
<title>bpo-41299: Reduce lag in Windows threading timeouts by using a higher precision time source (GH-26568)</title>
<updated>2021-06-07T20:26:02Z</updated>
<author>
<name>Ryan Hileman</name>
<email>lunixbochs@gmail.com</email>
</author>
<published>2021-06-07T20:26:02Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=449e6f0ef395231e3abe467f910b02d7f075c27f'/>
<id>urn:sha1:449e6f0ef395231e3abe467f910b02d7f075c27f</id>
<content type='text'>
</content>
</entry>
<entry>
<title>bpo-40268: Rename _PyInterpreterState_GET_UNSAFE() (GH-19509)</title>
<updated>2020-04-14T13:14:01Z</updated>
<author>
<name>Victor Stinner</name>
<email>vstinner@python.org</email>
</author>
<published>2020-04-14T13:14:01Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=81a7be3fa22c983209cc0ffb3537b92b0370f83c'/>
<id>urn:sha1:81a7be3fa22c983209cc0ffb3537b92b0370f83c</id>
<content type='text'>
Rename _PyInterpreterState_GET_UNSAFE() to _PyInterpreterState_GET()
for consistency with _PyThreadState_GET() and to have a shorter name
(help to fit into 80 columns).

Add also "assert(tstate != NULL);" to the function.</content>
</entry>
<entry>
<title>bpo-40268: Include explicitly pycore_interp.h (GH-19505)</title>
<updated>2020-04-14T12:26:24Z</updated>
<author>
<name>Victor Stinner</name>
<email>vstinner@python.org</email>
</author>
<published>2020-04-14T12:26:24Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=4a3fe0835310643193ea45529ab0fb45c5f8f2fd'/>
<id>urn:sha1:4a3fe0835310643193ea45529ab0fb45c5f8f2fd</id>
<content type='text'>
pycore_pystate.h no longer includes pycore_interp.h:
it's now included explicitly in files accessing PyInterpreterState.</content>
</entry>
<entry>
<title>bpo-39847: EnterNonRecursiveMutex() uses GetTickCount64() (GH-18780)</title>
<updated>2020-03-11T23:39:02Z</updated>
<author>
<name>bobince</name>
<email>and+github@doxdesk.com</email>
</author>
<published>2020-03-11T23:39:02Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=64838ce7172c7a92183b39b22504b433a33a884d'/>
<id>urn:sha1:64838ce7172c7a92183b39b22504b433a33a884d</id>
<content type='text'>
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 &lt;and.clover@bromium.com&gt;
</content>
</entry>
</feed>
