File indexing completed on 2025-01-18 10:06:46
0001 #ifndef Py_INTERNAL_PYTHREAD_H
0002 #define Py_INTERNAL_PYTHREAD_H
0003 #ifdef __cplusplus
0004 extern "C" {
0005 #endif
0006
0007 #ifndef Py_BUILD_CORE
0008 # error "this header requires Py_BUILD_CORE define"
0009 #endif
0010
0011
0012 #ifndef _POSIX_THREADS
0013
0014
0015
0016 # ifdef HAVE_PTHREAD_H
0017 # include <pthread.h> /* _POSIX_THREADS */
0018 # endif
0019 # ifndef _POSIX_THREADS
0020
0021
0022
0023
0024
0025
0026
0027
0028 # ifdef __hpux
0029 # ifdef _SC_THREADS
0030 # define _POSIX_THREADS
0031 # endif
0032 # endif
0033 # endif
0034 #endif
0035
0036 #if defined(_POSIX_THREADS) || defined(HAVE_PTHREAD_STUBS)
0037 # define _USE_PTHREADS
0038 #endif
0039
0040 #if defined(_USE_PTHREADS) && defined(HAVE_PTHREAD_CONDATTR_SETCLOCK) && defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC)
0041
0042 # define CONDATTR_MONOTONIC
0043 #endif
0044
0045
0046 #if defined(HAVE_PTHREAD_STUBS)
0047
0048 struct py_stub_tls_entry {
0049 bool in_use;
0050 void *value;
0051 };
0052 #endif
0053
0054 struct _pythread_runtime_state {
0055 int initialized;
0056
0057 #ifdef _USE_PTHREADS
0058
0059 struct {
0060
0061 pthread_condattr_t *ptr;
0062 # ifdef CONDATTR_MONOTONIC
0063
0064 pthread_condattr_t val;
0065 # endif
0066 } _condattr_monotonic;
0067
0068 #endif
0069
0070 #if defined(HAVE_PTHREAD_STUBS)
0071 struct {
0072 struct py_stub_tls_entry tls_entries[PTHREAD_KEYS_MAX];
0073 } stubs;
0074 #endif
0075 };
0076
0077
0078 #ifdef __cplusplus
0079 }
0080 #endif
0081 #endif