From eee06d1e8365ea1b1aa9363a3c6445745b002324 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Sun, 5 Dec 2021 17:28:40 -0500 Subject: Provide atomic pointer support. This is initially used for TLS to make loading the engine pointer faster, eliminating a much more expensive lock operation. --- 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 f1127c5b..89759921 100644 --- a/src/core/platform.h +++ b/src/core/platform.h @@ -232,6 +232,11 @@ extern void nni_atomic_inc(nni_atomic_int *); // true if the value was set. extern bool nni_atomic_cas(nni_atomic_int *, int, int); +// atomic pointers. We only support a few operations. +typedef struct nni_atomic_ptr nni_atomic_ptr; +extern void nni_atomic_set_ptr(nni_atomic_ptr *, void *); +extern void *nni_atomic_get_ptr(nni_atomic_ptr *); + // // Clock Support // -- cgit v1.2.3-70-g09d2