summaryrefslogtreecommitdiff
path: root/Include/pyport.h
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2017-10-24 16:53:32 -0700
committerGitHub <noreply@github.com>2017-10-24 16:53:32 -0700
commit850a18e03e8f8309bc8c39adc6e7d51a4568cd9a (patch)
tree56455b89cb152566734d1fc5de5c70029c3baa70 /Include/pyport.h
parent3557b05c5a7dfd7d97ddfd3b79aefd53d25e5132 (diff)
downloadcpython-git-850a18e03e8f8309bc8c39adc6e7d51a4568cd9a.tar.gz
bpo-30768: Recompute timeout on interrupted lock (GH-4103)
Fix the pthread+semaphore implementation of PyThread_acquire_lock_timed() when called with timeout > 0 and intr_flag=0: recompute the timeout if sem_timedwait() is interrupted by a signal (EINTR). See also the PEP 475. The pthread implementation of PyThread_acquire_lock() now fails with a fatal error if the timeout is larger than PY_TIMEOUT_MAX, as done in the Windows implementation. The check prevents any risk of overflow in PyThread_acquire_lock(). Add also PY_DWORD_MAX constant.
Diffstat (limited to 'Include/pyport.h')
-rw-r--r--Include/pyport.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/Include/pyport.h b/Include/pyport.h
index 2742e477fd..0e82543ac7 100644
--- a/Include/pyport.h
+++ b/Include/pyport.h
@@ -787,6 +787,9 @@ extern _invalid_parameter_handler _Py_silent_invalid_parameter_handler;
#include <android/api-level.h>
#endif
+/* Maximum value of the Windows DWORD type */
+#define PY_DWORD_MAX 4294967295U
+
/* This macro used to tell whether Python was built with multithreading
* enabled. Now multithreading is always enabled, but keep the macro
* for compatibility.