diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2020-03-07 11:35:43 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2020-03-07 11:35:43 +0100 |
commit | 98502444b0c5881797e4833ee1fc79388b94ba82 (patch) | |
tree | d0149c384bc2a5bcc98af2fa500a70558e51a395 /video-ps3eye | |
parent | 5abcf93c07ae630c7964c5117febb9e32a537e52 (diff) |
video/ps3eye: use portable barrier
Diffstat (limited to 'video-ps3eye')
-rw-r--r-- | video-ps3eye/wrapper.cxx | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/video-ps3eye/wrapper.cxx b/video-ps3eye/wrapper.cxx index 4a2c2000..291f3e8f 100644 --- a/video-ps3eye/wrapper.cxx +++ b/video-ps3eye/wrapper.cxx @@ -4,6 +4,7 @@ #include "ps3eye-driver/ps3eye.hpp" #include <cstdlib> +#include <atomic> #ifdef __clang__ # pragma clang diagnostic ignored "-Watomic-implicit-seq-cst" @@ -15,13 +16,6 @@ # pragma GCC diagnostic ignored "-Wformat-nonliteral" #endif -#ifdef _MSC_VER -# include <windows.h> -# define FULL_BARRIER [](){ _ReadWriteBarrier(); MemoryBarrier(); } -#else -# define FULL_BARRIER __sync_synchronize -#endif - template<int N, typename... xs> [[noreturn]] static void error(volatile ps3eye::shm_out& out, const char (&error)[N], const xs&... args) @@ -88,7 +82,7 @@ int main(int argc, char** argv) out.timecode = 0; in.do_exit = false; - FULL_BARRIER(); + std::atomic_thread_fence(std::memory_order_seq_cst); for (;;) { @@ -117,7 +111,7 @@ int main(int argc, char** argv) if (in.do_exit) break; - FULL_BARRIER(); + std::atomic_thread_fence(std::memory_order_seq_cst); } return 0; |