git: 4804cb433dbe - main - libthr: use atomic_add_int() instead of atomic_fetchadd_int()

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Tue, 14 Jan 2025 17:55:13 UTC
The branch main has been updated by kib:

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

commit 4804cb433dbec2555695dc2bf391f286f2172621
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2025-01-13 19:18:40 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2025-01-14 17:55:07 +0000

    libthr: use atomic_add_int() instead of atomic_fetchadd_int()
    
    the return value is ignored.
    
    Reviewed by:    markj, olce
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Differential revision:  https://reviews.freebsd.org/D48454
---
 lib/libthr/thread/thr_list.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/libthr/thread/thr_list.c b/lib/libthr/thread/thr_list.c
index 7da851dff681..bca2bfc75fef 100644
--- a/lib/libthr/thread/thr_list.c
+++ b/lib/libthr/thread/thr_list.c
@@ -149,16 +149,16 @@ _thr_alloc(struct pthread *curthread)
 	if (thread == NULL) {
 		if (total_threads > MAX_THREADS)
 			return (NULL);
-		atomic_fetchadd_int(&total_threads, 1);
+		atomic_add_int(&total_threads, 1);
 		thread = calloc(1, sizeof(struct pthread));
 		if (thread == NULL) {
-			atomic_fetchadd_int(&total_threads, -1);
+			atomic_add_int(&total_threads, -1);
 			return (NULL);
 		}
 		if ((thread->sleepqueue = _sleepq_alloc()) == NULL ||
 		    (thread->wake_addr = _thr_alloc_wake_addr()) == NULL) {
 			thr_destroy(curthread, thread);
-			atomic_fetchadd_int(&total_threads, -1);
+			atomic_add_int(&total_threads, -1);
 			return (NULL);
 		}
 	} else {
@@ -176,7 +176,7 @@ _thr_alloc(struct pthread *curthread)
 		thread->tcb = tcb;
 	} else {
 		thr_destroy(curthread, thread);
-		atomic_fetchadd_int(&total_threads, -1);
+		atomic_add_int(&total_threads, -1);
 		thread = NULL;
 	}
 	return (thread);
@@ -202,7 +202,7 @@ _thr_free(struct pthread *curthread, struct pthread *thread)
 	thread->tcb = NULL;
 	if ((curthread == NULL) || (free_thread_count >= MAX_CACHED_THREADS)) {
 		thr_destroy(curthread, thread);
-		atomic_fetchadd_int(&total_threads, -1);
+		atomic_add_int(&total_threads, -1);
 	} else {
 		/*
 		 * Add the thread to the free thread list, this also avoids