summaryrefslogtreecommitdiffstats
path: root/Python/thread_pthread.h
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2024-05-05 10:15:19 (GMT)
committerGitHub <noreply@github.com>2024-05-05 10:15:19 (GMT)
commitaa61f8bfcf2584dd8345f1f9a07e240100b79192 (patch)
treedb196e9316a20ff332290c56b60c38a6b533fae6 /Python/thread_pthread.h
parentc7c9b913c01afb8d2ff4048f82155969f7ef75b1 (diff)
downloadcpython-aa61f8bfcf2584dd8345f1f9a07e240100b79192.zip
cpython-aa61f8bfcf2584dd8345f1f9a07e240100b79192.tar.gz
cpython-aa61f8bfcf2584dd8345f1f9a07e240100b79192.tar.bz2
gh-110850: Remove _PyTime_TimeUnchecked() function (#118552)
Use the new public Raw functions: * _PyTime_PerfCounterUnchecked() with PyTime_PerfCounterRaw() * _PyTime_TimeUnchecked() with PyTime_TimeRaw() * _PyTime_MonotonicUnchecked() with PyTime_MonotonicRaw() Remove internal functions: * _PyTime_PerfCounterUnchecked() * _PyTime_TimeUnchecked() * _PyTime_MonotonicUnchecked()
Diffstat (limited to 'Python/thread_pthread.h')
-rw-r--r--Python/thread_pthread.h18
1 files changed, 13 insertions, 5 deletions
diff --git a/Python/thread_pthread.h b/Python/thread_pthread.h
index 65d366e..f588b46 100644
--- a/Python/thread_pthread.h
+++ b/Python/thread_pthread.h
@@ -158,12 +158,14 @@ _PyThread_cond_after(long long us, struct timespec *abs)
PyTime_t t;
#ifdef CONDATTR_MONOTONIC
if (condattr_monotonic) {
- t = _PyTime_MonotonicUnchecked();
+ // silently ignore error: cannot report error to the caller
+ (void)PyTime_MonotonicRaw(&t);
}
else
#endif
{
- t = _PyTime_TimeUnchecked();
+ // silently ignore error: cannot report error to the caller
+ (void)PyTime_TimeRaw(&t);
}
t = _PyTime_Add(t, timeout);
_PyTime_AsTimespec_clamp(t, abs);
@@ -506,7 +508,10 @@ PyThread_acquire_lock_timed(PyThread_type_lock lock, PY_TIMEOUT_T microseconds,
struct timespec abs_timeout;
// Local scope for deadline
{
- PyTime_t deadline = _PyTime_Add(_PyTime_MonotonicUnchecked(), timeout);
+ PyTime_t now;
+ // silently ignore error: cannot report error to the caller
+ (void)PyTime_MonotonicRaw(&now);
+ PyTime_t deadline = _PyTime_Add(now, timeout);
_PyTime_AsTimespec_clamp(deadline, &abs_timeout);
}
#else
@@ -522,8 +527,11 @@ PyThread_acquire_lock_timed(PyThread_type_lock lock, PY_TIMEOUT_T microseconds,
status = fix_status(sem_clockwait(thelock, CLOCK_MONOTONIC,
&abs_timeout));
#else
- PyTime_t abs_time = _PyTime_Add(_PyTime_TimeUnchecked(),
- timeout);
+ PyTime_t now;
+ // silently ignore error: cannot report error to the caller
+ (void)PyTime_TimeRaw(&now);
+ PyTime_t abs_time = _PyTime_Add(now, timeout);
+
struct timespec ts;
_PyTime_AsTimespec_clamp(abs_time, &ts);
status = fix_status(sem_timedwait(thelock, &ts));