Skip to content

Commit 1c85e28

Browse files
Drop WITH_THREAD.
1 parent 0f97249 commit 1c85e28

File tree

4 files changed

+0
-31
lines changed

4 files changed

+0
-31
lines changed

Include/internal/ceval.h

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,10 @@ extern "C" {
55
#endif
66

77
#include "pyatomic.h"
8-
9-
#ifdef WITH_THREAD
108
#include "pythread.h"
11-
#endif
129

1310
struct _pending_calls {
1411
unsigned long main_thread;
15-
#ifdef WITH_THREAD
1612
PyThread_type_lock lock;
1713
/* Request for running pending calls. */
1814
_Py_atomic_int calls_to_do;
@@ -27,16 +23,6 @@ struct _pending_calls {
2723
} calls[NPENDINGCALLS];
2824
int first;
2925
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 */
4026
};
4127

4228
#include "internal/gil.h"
@@ -53,10 +39,8 @@ struct _ceval_runtime_state {
5339
/* This single variable consolidates all requests to break out of
5440
the fast path in the eval loop. */
5541
_Py_atomic_int eval_breaker;
56-
#ifdef WITH_THREAD
5742
/* Request for dropping the GIL */
5843
_Py_atomic_int gil_drop_request;
59-
#endif
6044
struct _pending_calls pending;
6145
struct _gil_runtime_state gil;
6246
};

Include/internal/gil.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ struct _gil_runtime_state {
2727
_Py_atomic_int locked;
2828
/* Number of GIL switches since the beginning. */
2929
unsigned long switch_number;
30-
#ifdef WITH_THREAD
3130
/* This condition variable allows one or several threads to wait
3231
until the GIL is released. In addition, the mutex also protects
3332
the above variables. */
@@ -39,7 +38,6 @@ struct _gil_runtime_state {
3938
PyCOND_T switch_cond;
4039
PyMUTEX_T switch_mutex;
4140
#endif
42-
#endif /* WITH_THREAD */
4341
};
4442

4543
#ifdef __cplusplus

Include/internal/pystate.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@ extern "C" {
66

77
#include "pystate.h"
88
#include "pyatomic.h"
9-
10-
#ifdef WITH_THREAD
119
#include "pythread.h"
12-
#endif
1310

1411
#include "internal/mem.h"
1512
#include "internal/ceval.h"
@@ -24,14 +21,12 @@ struct _gilstate_runtime_state {
2421
PyThreadState for the current thread. */
2522
_Py_atomic_address tstate_current;
2623
PyThreadFrameGetter getframe;
27-
#ifdef WITH_THREAD
2824
/* The single PyInterpreterState used by this process'
2925
GILState implementation
3026
*/
3127
/* TODO: Given interp_main, it may be possible to kill this ref */
3228
PyInterpreterState *autoInterpreterState;
3329
int autoTLSkey;
34-
#endif /* WITH_THREAD */
3530
};
3631

3732
/* hook for PyEval_GetFrame(), requested for Psyco */
@@ -50,9 +45,7 @@ typedef struct pyruntimestate {
5045
PyThreadState *finalizing;
5146

5247
struct pyinterpreters {
53-
#ifdef WITH_THREAD
5448
PyThread_type_lock mutex;
55-
#endif
5649
PyInterpreterState *head;
5750
PyInterpreterState *main;
5851
/* _next_interp_id is an auto-numbered sequence of small

Python/pystate.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,23 +48,19 @@ _PyRuntimeState_Init(_PyRuntimeState *runtime)
4848
runtime->gilstate.check_enabled = 1;
4949
runtime->gilstate.autoTLSkey = -1;
5050

51-
#ifdef WITH_THREAD
5251
runtime->interpreters.mutex = PyThread_allocate_lock();
5352
if (runtime->interpreters.mutex == NULL)
5453
Py_FatalError("Can't initialize threads for interpreter");
55-
#endif
5654
runtime->interpreters.next_id = -1;
5755
}
5856

5957
void
6058
_PyRuntimeState_Fini(_PyRuntimeState *runtime)
6159
{
62-
#ifdef WITH_THREAD
6360
if (runtime->interpreters.mutex != NULL) {
6461
PyThread_free_lock(runtime->interpreters.mutex);
6562
runtime->interpreters.mutex = NULL;
6663
}
67-
#endif
6864
}
6965

7066
#define HEAD_LOCK() PyThread_acquire_lock(_PyRuntime.interpreters.mutex, \
@@ -77,7 +73,6 @@ void
7773
_PyInterpreterState_Enable(_PyRuntimeState *runtime)
7874
{
7975
runtime->interpreters.next_id = 0;
80-
#ifdef WITH_THREAD
8176
/* Since we only call _PyRuntimeState_Init() once per process
8277
(see _PyRuntime_Initialize()), we make sure the mutex is
8378
initialized here. */
@@ -86,7 +81,6 @@ _PyInterpreterState_Enable(_PyRuntimeState *runtime)
8681
if (runtime->interpreters.mutex == NULL)
8782
Py_FatalError("Can't initialize threads for interpreter");
8883
}
89-
#endif
9084
}
9185

9286
PyInterpreterState *

0 commit comments

Comments
 (0)