Commit 978c19f1 authored by Etienne Renault's avatar Etienne Renault
Browse files

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.
parent 07483cd4
...@@ -159,9 +159,9 @@ struct Thread { ...@@ -159,9 +159,9 @@ struct Thread {
* One has to wonder why this is missing from the C++0x stdlib. * One has to wonder why this is missing from the C++0x stdlib.
*/ */
struct SpinLock { struct SpinLock {
std::atomic_flag b; std::atomic_flag b = ATOMIC_FLAG_INIT;;
SpinLock() : b( ATOMIC_FLAG_INIT ) {} SpinLock() {}
void lock() { void lock() {
while( b.test_and_set() ); while( b.test_and_set() );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment