make Activity bool flags atomic

This commit is contained in:
Alex Fabijanic
2017-10-04 14:55:01 -05:00
parent a82d4e7293
commit 08eb1c7a4f

View File

@@ -113,7 +113,6 @@ public:
void start(ThreadPool& pool) void start(ThreadPool& pool)
{ {
FastMutex::ScopedLock lock(_mutex); FastMutex::ScopedLock lock(_mutex);
if (!_running) if (!_running)
{ {
_done.reset(); _done.reset();
@@ -135,7 +134,6 @@ public:
/// Requests to stop the activity. /// Requests to stop the activity.
{ {
FastMutex::ScopedLock lock(_mutex); FastMutex::ScopedLock lock(_mutex);
_stopped = true; _stopped = true;
} }
@@ -195,8 +193,8 @@ private:
C* _pOwner; C* _pOwner;
RunnableAdapterType _runnable; RunnableAdapterType _runnable;
volatile bool _stopped; std::atomic<bool> _stopped;
volatile bool _running; std::atomic<bool> _running;
Event _done; Event _done;
FastMutex _mutex; FastMutex _mutex;
}; };