From 3212effd30a65128db0a1f4f66d5e45e75838e43 Mon Sep 17 00:00:00 2001 From: Tristan Matthews <tristan.matthews@savoirfairelinux.com> Date: Thu, 26 Sep 2013 11:16:11 -0400 Subject: [PATCH] * #30600: video: use std::atomics --- daemon/src/sflthread.cpp | 4 +--- daemon/src/sflthread.h | 3 ++- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/daemon/src/sflthread.cpp b/daemon/src/sflthread.cpp index 30d9dba8a7..669714bf60 100644 --- a/daemon/src/sflthread.cpp +++ b/daemon/src/sflthread.cpp @@ -32,8 +32,6 @@ #include "sflthread.h" #include "logger.h" -#define set_false_atomic(x) static_cast<void>(__sync_fetch_and_and(x, false)) - void* SFLThread::run_(void* data) { SFLThread *obj = static_cast<SFLThread*>(data); @@ -72,7 +70,7 @@ void SFLThread::start() void SFLThread::stop() { - set_false_atomic(&running_); + running_ = false; } void SFLThread::join() diff --git a/daemon/src/sflthread.h b/daemon/src/sflthread.h index 6fdeb2cead..08c1c09011 100644 --- a/daemon/src/sflthread.h +++ b/daemon/src/sflthread.h @@ -33,6 +33,7 @@ #define __SFLTHREAD_H__ #include <pthread.h> +#include <atomic> class SFLThread { public: @@ -56,7 +57,7 @@ private: void mainloop_(); pthread_t thread_; - bool running_; + std::atomic<bool> running_; }; #endif // __SFLTHREAD_H__ -- GitLab