Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
RELOAD_SPIN_COUNT -> RELOAD_SPIN_MASK
Change-Id: I5df04888df81de26a04450a9a1a04d4db5026383
  • Loading branch information
dpdani committed Mar 23, 2026
commit 5fee9e4e0c484ae54fcb8474507ac6115bdc86da
6 changes: 3 additions & 3 deletions Python/lock.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ static const PyTime_t TIME_TO_BE_FAIR_NS = 1000*1000;
// enabled.
#if Py_GIL_DISABLED
static const int MAX_SPIN_COUNT = 40;
static const int RELOAD_SPIN_COUNT = 3;
static const int RELOAD_SPIN_MASK = 3;
#else
static const int MAX_SPIN_COUNT = 0;
static const int RELOAD_SPIN_COUNT = 1;
static const int RELOAD_SPIN_MASK = 1;
#endif

struct mutex_entry {
Expand Down Expand Up @@ -104,7 +104,7 @@ _PyMutex_LockTimed(PyMutex *m, PyTime_t timeout, _PyLockFlags flags)
// Spin for a bit.
_Py_yield();
spin_count++;
if (((spin_count + tid) & RELOAD_SPIN_COUNT) == 0) {
if (((spin_count + tid) & RELOAD_SPIN_MASK) == 0) {
v = _Py_atomic_load_uint8_relaxed(&m->_bits);
}
continue;
Expand Down
Loading