mirror of
https://github.com/python/cpython.git
synced 2025-07-07 19:35:27 +00:00
gh-110014: Fix _POSIX_THREADS and _POSIX_SEMAPHORES usage (#110139)
* pycore_pythread.h is now the central place to make sure that _POSIX_THREADS and _POSIX_SEMAPHORES macros are defined if available. * Make sure that pycore_pythread.h is included when _POSIX_THREADS and _POSIX_SEMAPHORES macros are tested. * PY_TIMEOUT_MAX is now defined as a constant, since its value depends on _POSIX_THREADS, instead of being defined as a macro. * Prevent integer overflow in the preprocessor when computing PY_TIMEOUT_MAX_VALUE on Windows: replace "0xFFFFFFFELL * 1000 < LLONG_MAX" with "0xFFFFFFFELL < LLONG_MAX / 1000". * Document the change and give hints how to fix affected code. * Add an exception for PY_TIMEOUT_MAX name to smelly.py * Add PY_TIMEOUT_MAX to the stable ABI
This commit is contained in:
parent
f3bb00ea12
commit
74e425ec18
13 changed files with 72 additions and 57 deletions
|
@ -1,4 +1,5 @@
|
|||
#include "pycore_interp.h" // _PyInterpreterState.threads.stacksize
|
||||
#include "pycore_interp.h" // _PyInterpreterState.threads.stacksize
|
||||
#include "pycore_pythread.h" // _POSIX_SEMAPHORES
|
||||
|
||||
/* Posix threads interface */
|
||||
|
||||
|
@ -84,10 +85,10 @@
|
|||
/* On FreeBSD 4.x, _POSIX_SEMAPHORES is defined empty, so
|
||||
we need to add 0 to make it work there as well. */
|
||||
#if (_POSIX_SEMAPHORES+0) == -1
|
||||
#define HAVE_BROKEN_POSIX_SEMAPHORES
|
||||
# define HAVE_BROKEN_POSIX_SEMAPHORES
|
||||
#else
|
||||
#include <semaphore.h>
|
||||
#include <errno.h>
|
||||
# include <semaphore.h>
|
||||
# include <errno.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue