mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
gh-111863: Rename Py_NOGIL
to Py_GIL_DISABLED
(#111864)
Rename Py_NOGIL to Py_GIL_DISABLED
This commit is contained in:
parent
1c8f912ebd
commit
3b3ec0d77f
39 changed files with 82 additions and 81 deletions
|
@ -46,13 +46,13 @@
|
|||
# error "ceval.c must be build with Py_BUILD_CORE define for best performance"
|
||||
#endif
|
||||
|
||||
#if !defined(Py_DEBUG) && !defined(Py_TRACE_REFS) && !defined(Py_NOGIL)
|
||||
#if !defined(Py_DEBUG) && !defined(Py_TRACE_REFS) && !defined(Py_GIL_DISABLED)
|
||||
// GH-89279: The MSVC compiler does not inline these static inline functions
|
||||
// in PGO build in _PyEval_EvalFrameDefault(), because this function is over
|
||||
// the limit of PGO, and that limit cannot be configured.
|
||||
// Define them as macros to make sure that they are always inlined by the
|
||||
// preprocessor.
|
||||
// TODO: implement Py_DECREF macro for Py_NOGIL
|
||||
// TODO: implement Py_DECREF macro for Py_GIL_DISABLED
|
||||
|
||||
#undef Py_DECREF
|
||||
#define Py_DECREF(arg) \
|
||||
|
|
|
@ -21,7 +21,7 @@ static const _PyTime_t TIME_TO_BE_FAIR_NS = 1000*1000;
|
|||
// Spin for a bit before parking the thread. This is only enabled for
|
||||
// `--disable-gil` builds because it is unlikely to be helpful if the GIL is
|
||||
// enabled.
|
||||
#if Py_NOGIL
|
||||
#if Py_GIL_DISABLED
|
||||
static const int MAX_SPIN_COUNT = 40;
|
||||
#else
|
||||
static const int MAX_SPIN_COUNT = 0;
|
||||
|
|
|
@ -1857,7 +1857,7 @@ tstate_deactivate(PyThreadState *tstate)
|
|||
static int
|
||||
tstate_try_attach(PyThreadState *tstate)
|
||||
{
|
||||
#ifdef Py_NOGIL
|
||||
#ifdef Py_GIL_DISABLED
|
||||
int expected = _Py_THREAD_DETACHED;
|
||||
if (_Py_atomic_compare_exchange_int(
|
||||
&tstate->state,
|
||||
|
@ -1877,7 +1877,7 @@ static void
|
|||
tstate_set_detached(PyThreadState *tstate)
|
||||
{
|
||||
assert(tstate->state == _Py_THREAD_ATTACHED);
|
||||
#ifdef Py_NOGIL
|
||||
#ifdef Py_GIL_DISABLED
|
||||
_Py_atomic_store_int(&tstate->state, _Py_THREAD_DETACHED);
|
||||
#else
|
||||
tstate->state = _Py_THREAD_DETACHED;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue