From 98502444b0c5881797e4833ee1fc79388b94ba82 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 7 Mar 2020 11:35:43 +0100 Subject: video/ps3eye: use portable barrier --- video-ps3eye/wrapper.cxx | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'video-ps3eye') 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 +#include #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 -# define FULL_BARRIER [](){ _ReadWriteBarrier(); MemoryBarrier(); } -#else -# define FULL_BARRIER __sync_synchronize -#endif - template [[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; -- cgit v1.2.3