-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathBarrierSTD.cc
More file actions
28 lines (19 loc) · 940 Bytes
/
BarrierSTD.cc
File metadata and controls
28 lines (19 loc) · 940 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Can have callback because supported of std::barrier but no distinguished-thread; cannot perform barrier check as
// barrier type is opaque.
#include "BarrierCallback.h"
#include <barrier>
CB( void callback( void ) {} ) // closure for callback before triggering barrier
static TYPE PAD1 CALIGN __attribute__(( unused )); // protect further false sharing
static TYPE PAD2 CALIGN __attribute__(( unused )); // protect further false sharing
#define BARRIER_DECL static std::barrier b( N CB(, callback ) )
#define BARRIER_CALL b.arrive_and_wait()
#include "BarrierWorker.c"
void __attribute__((noinline)) ctor() {
worker_ctor();
} // ctor
void __attribute__((noinline)) dtor() {
worker_dtor();
} // dtor
// Local Variables: //
// compile-command: "g++ -Wall -Wextra -Werror -Wno-volatile -std=c++20 -O3 -DNDEBUG -fno-reorder-functions -DPIN -DAlgorithm=BarrierSTD Harness.c -lpthread -lm -D`hostname` -DCFMT" //
// End: //