bricks: ATOMIC_FLAG_INIT initialization

From the working draft: "The macro ATOMIC_FLAG_INIT shall be defined
in such a way that it can be used to initialize an object of type
atomic_flag to the clear state. The macro can be used in the form:
atomic_flag guard = ATOMIC_FLAG_INIT; It is unspecified whether the
macro can be used in other initialization contexts."

* bricks/brick-shmem.h: here.
This commit is contained in:
Etienne Renault 2016-04-11 15:48:18 +02:00
parent f04074bd6d
commit 6d3154be94

View file

@ -159,9 +159,9 @@ struct Thread {
* One has to wonder why this is missing from the C++0x stdlib.
*/
struct SpinLock {
std::atomic_flag b;
std::atomic_flag b = ATOMIC_FLAG_INIT;;
SpinLock() : b( ATOMIC_FLAG_INIT ) {}
SpinLock() {}
void lock() {
while( b.test_and_set() );