From ec4ddf8b95585cc3e340dd06df109f83a23b2d77 Mon Sep 17 00:00:00 2001 From: Richard Braun Date: Sat, 21 Apr 2018 10:42:11 +0200 Subject: Fix atomic operations argument types In preparation of the rework of atomic operations, all atomic function calls are fixed to use fully supported, compatible types. This means that atomic operations ar erestricted to 32-bit and 64-bit, and that value types must be strictly compatible with pointer types. --- kern/thread.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'kern/thread.h') diff --git a/kern/thread.h b/kern/thread.h index eba9bf2..4bead75 100644 --- a/kern/thread.h +++ b/kern/thread.h @@ -288,7 +288,7 @@ thread_ref(struct thread *thread) { unsigned long nr_refs; - nr_refs = atomic_fetch_add(&thread->nr_refs, 1, ATOMIC_RELAXED); + nr_refs = atomic_fetch_add(&thread->nr_refs, 1UL, ATOMIC_RELAXED); assert(nr_refs != (unsigned long)-1); } @@ -297,7 +297,7 @@ thread_unref(struct thread *thread) { unsigned long nr_refs; - nr_refs = atomic_fetch_sub(&thread->nr_refs, 1, ATOMIC_ACQ_REL); + nr_refs = atomic_fetch_sub(&thread->nr_refs, 1UL, ATOMIC_ACQ_REL); assert(nr_refs != 0); if (nr_refs == 1) { -- cgit v1.2.3