git: 6ef72b6bdb35 - stable/15 - libthr mutex_self_lock(): handle signals and clock steps
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 17 Nov 2026 01:09:58 UTC
The branch stable/15 has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=6ef72b6bdb350b7421fe482cf5db912ad6632810
commit 6ef72b6bdb350b7421fe482cf5db912ad6632810
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2026-11-10 03:07:01 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2026-11-17 00:25:05 +0000
libthr mutex_self_lock(): handle signals and clock steps
(cherry picked from commit 1b4779eef93c6e3c9af1887b941d7700ef143951)
---
lib/libthr/thread/thr_mutex.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/lib/libthr/thread/thr_mutex.c b/lib/libthr/thread/thr_mutex.c
index a81f36d35135..f5969ca7b73c 100644
--- a/lib/libthr/thread/thr_mutex.c
+++ b/lib/libthr/thread/thr_mutex.c
@@ -903,8 +903,9 @@ static int
mutex_self_lock(struct pthread_mutex *m, const struct timespec *abstime,
clockid_t clockid)
{
- struct timespec ts1, ts2;
+ struct timespec ts1;
int ret;
+ u_int dummy;
switch (PMUTEX_TYPE(m->m_flags)) {
case PTHREAD_MUTEX_ERRORCHECK:
@@ -930,8 +931,11 @@ mutex_self_lock(struct pthread_mutex *m, const struct timespec *abstime,
clock_gettime(clockid, &ts1) == -1) {
ret = EINVAL;
} else {
- TIMESPEC_SUB(&ts2, abstime, &ts1);
- __sys_nanosleep(&ts2, NULL);
+ dummy = 0;
+ do {
+ ret = _thr_umtx_timedwait_uint(&dummy,
+ 0, clockid, abstime, 0);
+ } while (ret == 0 || ret == EINTR);
ret = ETIMEDOUT;
}
} else {