git: a944e6d5c0c2 - main - thr_cancel.c: use testcancel() instead of manually expanding it

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Sat, 28 Dec 2024 17:20:24 UTC
The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=a944e6d5c0c27c2a533486062497a40d8f0ae543

commit a944e6d5c0c27c2a533486062497a40d8f0ae543
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2024-12-21 17:55:39 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2024-12-28 17:01:44 +0000

    thr_cancel.c: use testcancel() instead of manually expanding it
    
    Reviewed by:    markj
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Differential revision:  https://reviews.freebsd.org/D48200
---
 lib/libthr/thread/thr_cancel.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/lib/libthr/thread/thr_cancel.c b/lib/libthr/thread/thr_cancel.c
index 0e00c2c36086..7622e306f937 100644
--- a/lib/libthr/thread/thr_cancel.c
+++ b/lib/libthr/thread/thr_cancel.c
@@ -166,9 +166,8 @@ void
 _thr_cancel_leave(struct pthread *curthread, int maycancel)
 {
 	curthread->cancel_point = 0;
-	if (__predict_false(SHOULD_CANCEL(curthread) &&
-	    !THR_IN_CRITICAL(curthread) && maycancel))
-		_pthread_exit(PTHREAD_CANCELED);
+	if (maycancel)
+		testcancel(curthread);
 }
 
 void