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/platform/posix/posix_impl.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/platform/posix/posix_impl.h')
| -rw-r--r-- | src/platform/posix/posix_impl.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/platform/posix/posix_impl.h b/src/platform/posix/posix_impl.h index 851c80dc..234d1501 100644 --- a/src/platform/posix/posix_impl.h +++ b/src/platform/posix/posix_impl.h @@ -64,7 +64,7 @@ struct nni_rwlock { struct nni_plat_cv { pthread_cond_t cv; - nni_plat_mtx * mtx; + nni_plat_mtx *mtx; }; struct nni_plat_thr { @@ -99,6 +99,10 @@ struct nni_atomic_bool { atomic_bool v; }; +struct nni_atomic_ptr { + atomic_uintptr_t v; +}; + #else // NNG_HAVE_C11_ATOMIC struct nni_atomic_flag { bool f; @@ -116,6 +120,10 @@ struct nni_atomic_u64 { uint64_t v; }; +struct nni_atomic_ptr { + void *v; +}; + #endif #endif |
