From b1730c99f882fc2662c6b64371a4b11a8231bb9f Mon Sep 17 00:00:00 2001 From: Agustina Arzille Date: Mon, 3 Apr 2017 16:09:51 +0200 Subject: Use the new atomic operations interface Stick to a sequentially consistent model for most atomic operations as it matches the semantics of the existing code. Each call site will have to be reevaluated in order to switch to more relaxed accesses where possible. --- kern/thread.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'kern/thread.c') diff --git a/kern/thread.c b/kern/thread.c index 4d8ce74a..8a87acaa 100644 --- a/kern/thread.c +++ b/kern/thread.c @@ -86,6 +86,7 @@ #include #include +#include #include #include #include @@ -107,7 +108,6 @@ #include #include #include -#include #include #include #include @@ -2723,7 +2723,7 @@ thread_key_create(unsigned int *keyp, thread_dtor_fn_t dtor) { unsigned int key; - key = atomic_fetchadd_uint(&thread_nr_keys, 1); + key = atomic_fetch_add(&thread_nr_keys, 1, ATOMIC_SEQ_CST); if (key >= THREAD_KEYS_MAX) { panic("thread: maximum number of keys exceeded"); -- cgit v1.2.3