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:
parent
f04074bd6d
commit
6d3154be94
1 changed files with 2 additions and 2 deletions
|
|
@ -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() );
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue