git: 20f173fdc7c7 - stable/14 - thr_cancel.c: use testcancel() instead of manually expanding it

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Sat, 04 Jan 2025 03:57:47 UTC
The branch stable/14 has been updated by kib:

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

commit 20f173fdc7c70cc2185b8d38cd7ce997e78db795
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2024-12-21 17:55:39 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2025-01-04 03:57:24 +0000

    thr_cancel.c: use testcancel() instead of manually expanding it
    
    (cherry picked from commit a944e6d5c0c27c2a533486062497a40d8f0ae543)
---
 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