aboutsummaryrefslogtreecommitdiff
path: root/src/core/platform.h
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2024-12-22 17:17:38 -0800
committerGarrett D'Amore <garrett@damore.org>2024-12-22 17:17:38 -0800
commit4104962dfc897f51f0b6e7bfabd2e9766085400e (patch)
tree3d404f920f0d29dbbc66e5b38a36eece66f6d38c /src/core/platform.h
parent6055f936411ca832abbfcbddba23e1e638f77e26 (diff)
downloadnng-4104962dfc897f51f0b6e7bfabd2e9766085400e.tar.gz
nng-4104962dfc897f51f0b6e7bfabd2e9766085400e.tar.bz2
nng-4104962dfc897f51f0b6e7bfabd2e9766085400e.zip
pollers: use atomic bit masking operations to eliminate lockss
This is done for kqueue and poll. Others coming soon.
Diffstat (limited to 'src/core/platform.h')
-rw-r--r--src/core/platform.h5
1 files changed, 5 insertions, 0 deletions
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