File tree Expand file tree Collapse file tree 4 files changed +0
-31
lines changed Expand file tree Collapse file tree 4 files changed +0
-31
lines changed Original file line number Diff line number Diff line change @@ -5,14 +5,10 @@ extern "C" {
5
5
#endif
6
6
7
7
#include "pyatomic.h"
8
-
9
- #ifdef WITH_THREAD
10
8
#include "pythread.h"
11
- #endif
12
9
13
10
struct _pending_calls {
14
11
unsigned long main_thread ;
15
- #ifdef WITH_THREAD
16
12
PyThread_type_lock lock ;
17
13
/* Request for running pending calls. */
18
14
_Py_atomic_int calls_to_do ;
@@ -27,16 +23,6 @@ struct _pending_calls {
27
23
} calls [NPENDINGCALLS ];
28
24
int first ;
29
25
int last ;
30
- #else /* ! WITH_THREAD */
31
- _Py_atomic_int calls_to_do ;
32
- #define NPENDINGCALLS 32
33
- struct {
34
- int (* func )(void * );
35
- void * arg ;
36
- } calls [NPENDINGCALLS ];
37
- volatile int first ;
38
- volatile int last ;
39
- #endif /* WITH_THREAD */
40
26
};
41
27
42
28
#include "internal/gil.h"
@@ -53,10 +39,8 @@ struct _ceval_runtime_state {
53
39
/* This single variable consolidates all requests to break out of
54
40
the fast path in the eval loop. */
55
41
_Py_atomic_int eval_breaker ;
56
- #ifdef WITH_THREAD
57
42
/* Request for dropping the GIL */
58
43
_Py_atomic_int gil_drop_request ;
59
- #endif
60
44
struct _pending_calls pending ;
61
45
struct _gil_runtime_state gil ;
62
46
};
Original file line number Diff line number Diff line change @@ -27,7 +27,6 @@ struct _gil_runtime_state {
27
27
_Py_atomic_int locked ;
28
28
/* Number of GIL switches since the beginning. */
29
29
unsigned long switch_number ;
30
- #ifdef WITH_THREAD
31
30
/* This condition variable allows one or several threads to wait
32
31
until the GIL is released. In addition, the mutex also protects
33
32
the above variables. */
@@ -39,7 +38,6 @@ struct _gil_runtime_state {
39
38
PyCOND_T switch_cond ;
40
39
PyMUTEX_T switch_mutex ;
41
40
#endif
42
- #endif /* WITH_THREAD */
43
41
};
44
42
45
43
#ifdef __cplusplus
Original file line number Diff line number Diff line change @@ -6,10 +6,7 @@ extern "C" {
6
6
7
7
#include "pystate.h"
8
8
#include "pyatomic.h"
9
-
10
- #ifdef WITH_THREAD
11
9
#include "pythread.h"
12
- #endif
13
10
14
11
#include "internal/mem.h"
15
12
#include "internal/ceval.h"
@@ -24,14 +21,12 @@ struct _gilstate_runtime_state {
24
21
PyThreadState for the current thread. */
25
22
_Py_atomic_address tstate_current ;
26
23
PyThreadFrameGetter getframe ;
27
- #ifdef WITH_THREAD
28
24
/* The single PyInterpreterState used by this process'
29
25
GILState implementation
30
26
*/
31
27
/* TODO: Given interp_main, it may be possible to kill this ref */
32
28
PyInterpreterState * autoInterpreterState ;
33
29
int autoTLSkey ;
34
- #endif /* WITH_THREAD */
35
30
};
36
31
37
32
/* hook for PyEval_GetFrame(), requested for Psyco */
@@ -50,9 +45,7 @@ typedef struct pyruntimestate {
50
45
PyThreadState * finalizing ;
51
46
52
47
struct pyinterpreters {
53
- #ifdef WITH_THREAD
54
48
PyThread_type_lock mutex ;
55
- #endif
56
49
PyInterpreterState * head ;
57
50
PyInterpreterState * main ;
58
51
/* _next_interp_id is an auto-numbered sequence of small
Original file line number Diff line number Diff line change @@ -48,23 +48,19 @@ _PyRuntimeState_Init(_PyRuntimeState *runtime)
48
48
runtime -> gilstate .check_enabled = 1 ;
49
49
runtime -> gilstate .autoTLSkey = -1 ;
50
50
51
- #ifdef WITH_THREAD
52
51
runtime -> interpreters .mutex = PyThread_allocate_lock ();
53
52
if (runtime -> interpreters .mutex == NULL )
54
53
Py_FatalError ("Can't initialize threads for interpreter" );
55
- #endif
56
54
runtime -> interpreters .next_id = -1 ;
57
55
}
58
56
59
57
void
60
58
_PyRuntimeState_Fini (_PyRuntimeState * runtime )
61
59
{
62
- #ifdef WITH_THREAD
63
60
if (runtime -> interpreters .mutex != NULL ) {
64
61
PyThread_free_lock (runtime -> interpreters .mutex );
65
62
runtime -> interpreters .mutex = NULL ;
66
63
}
67
- #endif
68
64
}
69
65
70
66
#define HEAD_LOCK () PyThread_acquire_lock(_PyRuntime.interpreters.mutex, \
77
73
_PyInterpreterState_Enable (_PyRuntimeState * runtime )
78
74
{
79
75
runtime -> interpreters .next_id = 0 ;
80
- #ifdef WITH_THREAD
81
76
/* Since we only call _PyRuntimeState_Init() once per process
82
77
(see _PyRuntime_Initialize()), we make sure the mutex is
83
78
initialized here. */
@@ -86,7 +81,6 @@ _PyInterpreterState_Enable(_PyRuntimeState *runtime)
86
81
if (runtime -> interpreters .mutex == NULL )
87
82
Py_FatalError ("Can't initialize threads for interpreter" );
88
83
}
89
- #endif
90
84
}
91
85
92
86
PyInterpreterState *
You can’t perform that action at this time.
0 commit comments