From 6d3154be9431583ef0dbedb782bf79234566f06a Mon Sep 17 00:00:00 2001 From: Etienne Renault Date: Mon, 11 Apr 2016 15:48:18 +0200 Subject: [PATCH] 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. --- bricks/brick-shmem.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bricks/brick-shmem.h b/bricks/brick-shmem.h index a4325da8b..f7639ecbf 100644 --- a/bricks/brick-shmem.h +++ b/bricks/brick-shmem.h @@ -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() );