Merge pull request #2776 from cuberite/AtomicBoolIsthread
Use atomic bool for isthread terminate
This commit is contained in:
commit
60dec884e4
@ -17,6 +17,7 @@ In the descending class' constructor call the Start() method to start the thread
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
#include <atomic>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -30,7 +31,7 @@ protected:
|
|||||||
virtual void Execute(void) = 0;
|
virtual void Execute(void) = 0;
|
||||||
|
|
||||||
/** The overriden Execute() method should check this value periodically and terminate if this is true. */
|
/** The overriden Execute() method should check this value periodically and terminate if this is true. */
|
||||||
volatile bool m_ShouldTerminate;
|
std::atomic<bool> m_ShouldTerminate;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
cIsThread(const AString & a_ThreadName);
|
cIsThread(const AString & a_ThreadName);
|
||||||
|
Loading…
Reference in New Issue
Block a user