diff options
| author | Victor Stinner <vstinner@python.org> | 2024-02-20 15:02:27 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-20 15:02:27 (GMT) |
| commit | 9af80ec83d1647a472331bd1333a7fa9108fe98e (patch) | |
| tree | 855d09a92949b6cbe2b6a9c177bfd399a87a2fa6 /Python/lock.c | |
| parent | 0749244d13412d7cb5b53d834f586f2198f5b9a6 (diff) | |
| download | cpython-9af80ec83d1647a472331bd1333a7fa9108fe98e.zip cpython-9af80ec83d1647a472331bd1333a7fa9108fe98e.tar.gz cpython-9af80ec83d1647a472331bd1333a7fa9108fe98e.tar.bz2 | |
gh-110850: Replace _PyTime_t with PyTime_t (#115719)
Run command:
sed -i -e 's!\<_PyTime_t\>!PyTime_t!g' $(find -name "*.c" -o -name "*.h")
Diffstat (limited to 'Python/lock.c')
| -rw-r--r-- | Python/lock.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/Python/lock.c b/Python/lock.c index bf01436..0c0d298 100644 --- a/Python/lock.c +++ b/Python/lock.c @@ -16,7 +16,7 @@ // If a thread waits on a lock for longer than TIME_TO_BE_FAIR_NS (1 ms), then // the unlocking thread directly hands off ownership of the lock. This avoids // starvation. -static const _PyTime_t TIME_TO_BE_FAIR_NS = 1000*1000; +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 @@ -30,7 +30,7 @@ static const int MAX_SPIN_COUNT = 0; struct mutex_entry { // The time after which the unlocking thread should hand off lock ownership // directly to the waiting thread. Written by the waiting thread. - _PyTime_t time_to_be_fair; + PyTime_t time_to_be_fair; // Set to 1 if the lock was handed off. Written by the unlocking thread. int handed_off; @@ -53,7 +53,7 @@ _PyMutex_LockSlow(PyMutex *m) } PyLockStatus -_PyMutex_LockTimed(PyMutex *m, _PyTime_t timeout, _PyLockFlags flags) +_PyMutex_LockTimed(PyMutex *m, PyTime_t timeout, _PyLockFlags flags) { uint8_t v = _Py_atomic_load_uint8_relaxed(&m->v); if ((v & _Py_LOCKED) == 0) { @@ -65,8 +65,8 @@ _PyMutex_LockTimed(PyMutex *m, _PyTime_t timeout, _PyLockFlags flags) return PY_LOCK_FAILURE; } - _PyTime_t now = _PyTime_GetMonotonicClock(); - _PyTime_t endtime = 0; + PyTime_t now = _PyTime_GetMonotonicClock(); + PyTime_t endtime = 0; if (timeout > 0) { endtime = _PyTime_Add(now, timeout); } @@ -142,7 +142,7 @@ mutex_unpark(PyMutex *m, struct mutex_entry *entry, int has_more_waiters) { uint8_t v = 0; if (entry) { - _PyTime_t now = _PyTime_GetMonotonicClock(); + PyTime_t now = _PyTime_GetMonotonicClock(); int should_be_fair = now > entry->time_to_be_fair; entry->handed_off = should_be_fair; @@ -274,7 +274,7 @@ PyEvent_Wait(PyEvent *evt) } int -PyEvent_WaitTimed(PyEvent *evt, _PyTime_t timeout_ns) +PyEvent_WaitTimed(PyEvent *evt, PyTime_t timeout_ns) { for (;;) { uint8_t v = _Py_atomic_load_uint8(&evt->v); |
