git: 6071292d39ab - main - libthr: Return EDEADLK if it is held by ourself
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 03 Nov 2026 06:51:57 UTC
The branch main has been updated by aokblast:
URL: https://cgit.FreeBSD.org/src/commit/?id=6071292d39ab1b571b7e6b6858c4b59b652784d7
commit 6071292d39ab1b571b7e6b6858c4b59b652784d7
Author: ShengYi Hung <aokblast@FreeBSD.org>
AuthorDate: 2026-10-21 06:09:00 +0000
Commit: ShengYi Hung <aokblast@FreeBSD.org>
CommitDate: 2026-11-03 06:51:49 +0000
libthr: Return EDEADLK if it is held by ourself
Reviewed by: kib, markj
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D60959
---
lib/libthr/thread/thr_rwlock.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/lib/libthr/thread/thr_rwlock.c b/lib/libthr/thread/thr_rwlock.c
index 5fd1e1dcb14a..8bc22814f45b 100644
--- a/lib/libthr/thread/thr_rwlock.c
+++ b/lib/libthr/thread/thr_rwlock.c
@@ -217,6 +217,9 @@ rwlock_rdlock_common(pthread_rwlock_t *rwlock, const struct timespec *abstime)
return (ret);
}
+ if (__predict_false(prwlock->owner == TID(curthread)))
+ return (EDEADLK);
+
if (__predict_false(abstime_invalid(abstime)))
return (EINVAL);
@@ -311,6 +314,9 @@ rwlock_wrlock_common(pthread_rwlock_t *rwlock, const struct timespec *abstime)
return (ret);
}
+ if (__predict_false(prwlock->owner == TID(curthread)))
+ return (EDEADLK);
+
if (__predict_false(abstime_invalid(abstime)))
return (EINVAL);