diff options
| author | Garrett D'Amore <garrett@damore.org> | 2018-07-02 22:36:08 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2018-07-03 19:00:19 -0700 |
| commit | d1a9c84a6b375cb25a8b7475957130e364b41753 (patch) | |
| tree | 5444721d96a84d92e3ed258b4d51f80adf6b200c /src/platform/posix/posix_impl.h | |
| parent | a772bcc6ebe198f939889abbda18eded2a326941 (diff) | |
| download | nng-d1a9c84a6b375cb25a8b7475957130e364b41753.tar.gz nng-d1a9c84a6b375cb25a8b7475957130e364b41753.tar.bz2 nng-d1a9c84a6b375cb25a8b7475957130e364b41753.zip | |
fixes #572 Several locking errors found
fixes #573 atomic flags could help
This introduces a new atomic flag, and reduces some of the global
locking. The lock refactoring work is not yet complete, but this is
a positive step forward, and should help with certain things.
While here we also fixed a compile warning due to incorrect types.
Diffstat (limited to 'src/platform/posix/posix_impl.h')
| -rw-r--r-- | src/platform/posix/posix_impl.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/platform/posix/posix_impl.h b/src/platform/posix/posix_impl.h index 33a9c293..70a3615f 100644 --- a/src/platform/posix/posix_impl.h +++ b/src/platform/posix/posix_impl.h @@ -75,6 +75,19 @@ struct nni_plat_flock { #define NNG_PLATFORM_DIR_SEP "/" +#ifdef NNG_HAVE_STDATOMIC + +#include <stdatomic.h> + +struct nni_atomic_flag { + atomic_flag f; +}; +#else // NNG_HAVE_C11_ATOMIC +struct nni_atomic_flag { + bool f; +}; +#endif + #endif extern int nni_posix_pollq_sysinit(void); |
