From 4104962dfc897f51f0b6e7bfabd2e9766085400e Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Sun, 22 Dec 2024 17:17:38 -0800 Subject: pollers: use atomic bit masking operations to eliminate lockss This is done for kqueue and poll. Others coming soon. --- src/core/platform.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/core') diff --git a/src/core/platform.h b/src/core/platform.h index 2f5b5c17..8b7aabbc 100644 --- a/src/core/platform.h +++ b/src/core/platform.h @@ -217,6 +217,11 @@ extern int nni_atomic_get(nni_atomic_int *); extern void nni_atomic_set(nni_atomic_int *, int); extern int nni_atomic_swap(nni_atomic_int *, int); +// These are used with acquire release semantics. +// Used for pollers in the POSIX code. They return the previous value. +extern int nni_atomic_or(nni_atomic_int *, int); +extern int nni_atomic_and(nni_atomic_int *, int); + // These versions are tuned for use as reference // counters. Relaxed order when possible to increase // reference count, acquire-release order for dropping -- cgit v1.2.3-70-g09d2