Hello,
I include <atomic>
I use functions test_and_set() and clear().
Programming language C++14 and my compiler is armclang 6.18 I get the errors:
Some recommendations or suggestions?
Thank you in advance
I don't use any special compiler or linker flags regarding the atomic library. I use it in code like this:
header file:
#include <atomic>
namespace some_namespace{class SomeClass{public: SomeClass(std::atomic_flag* ExclusiveOperation = nullptr) : exclusiveOperation(ExclusiveOperation) {} void someFunction(void);private: void anotherFunction(void); std::atomic_flag* const exclusiveOperation{nullptr};};}
cpp file that implements class functions:
#include "header_file.hpp"
namespace some_namespace{void SomeClass::someFunction(void){ if(exclusiveOperation != nullptr && exclusiveOperation->test_and_set()) {}}
void SomeClass::anotherFunction(void){ if(exclusiveOperation != nullptr)
{
exclusiveOperation->clear();
}
cpp file where class instance is created:
std::atomic_flag exclusiveOperation = ATOMIC_FLAG_INIT;SomeClass someClassInstance(&exclusiveOperation);