git: 0961e16b3668 - stable/14 - libthr: use atomic_add_int() instead of atomic_fetchadd_int()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 21 Jan 2025 00:26:39 UTC
The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=0961e16b36684d4755ad16d789c9f4cb509c8f39 commit 0961e16b36684d4755ad16d789c9f4cb509c8f39 Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2025-01-13 19:18:40 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2025-01-21 00:24:55 +0000 libthr: use atomic_add_int() instead of atomic_fetchadd_int() (cherry picked from commit 4804cb433dbec2555695dc2bf391f286f2172621) --- 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 72018d94f496..d13cead7e588 100644 --- a/lib/libthr/thread/thr_list.c +++ b/lib/libthr/thread/thr_list.c @@ -150,16 +150,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 { @@ -177,7 +177,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); @@ -203,7 +203,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