diff options
| author | Garrett D'Amore <garrett@damore.org> | 2021-12-05 17:28:40 -0500 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2021-12-05 17:28:40 -0500 |
| commit | eee06d1e8365ea1b1aa9363a3c6445745b002324 (patch) | |
| tree | 101363a56893db15b7aeaf90d074f8c4b438f138 /src/core/platform.h | |
| parent | 111b241473ceeecee1f1c232d3c9879fb850361d (diff) | |
| download | nng-eee06d1e8365ea1b1aa9363a3c6445745b002324.tar.gz nng-eee06d1e8365ea1b1aa9363a3c6445745b002324.tar.bz2 nng-eee06d1e8365ea1b1aa9363a3c6445745b002324.zip | |
Provide atomic pointer support.
This is initially used for TLS to make loading the engine pointer
faster, eliminating a much more expensive lock operation.
Diffstat (limited to 'src/core/platform.h')
| -rw-r--r-- | src/core/platform.h | 5 |
1 files changed, 5 insertions, 0 deletions
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 // |
