Skip to content

Commit 3c5075a

Browse files
committed
Refactor thread-local storage to use _Thread_local instead of __thread for better compliance with the C11 standard.
1 parent 09f1d75 commit 3c5075a

File tree

17 files changed

+55
-158
lines changed

17 files changed

+55
-158
lines changed

benchmarks/clhqueuebench.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ int64_t d1 CACHE_ALIGN, d2;
3131
SynchBarrier bar CACHE_ALIGN;
3232
SynchBenchArgs bench_args CACHE_ALIGN;
3333

34-
__thread SynchPoolStruct pool_node;
34+
_Thread_local SynchPoolStruct pool_node;
3535

3636
static void enqueue(Object arg, int pid) {
3737
Node *n = synchAllocObj(&pool_node);

benchmarks/clhstackbench.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ int64_t d1 CACHE_ALIGN, d2;
2626
SynchBarrier bar CACHE_ALIGN;
2727
SynchBenchArgs bench_args CACHE_ALIGN;
2828

29-
__thread SynchPoolStruct pool_node;
29+
_Thread_local SynchPoolStruct pool_node;
3030

3131
static void push(Object arg, int pid) {
3232
volatile Node *n = synchAllocObj(&pool_node);

libconcurrent/concurrent/ccqueue.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
static RetVal serialEnqueue(void *state, ArgVal arg, int pid);
55
static RetVal serialDequeue(void *state, ArgVal arg, int pid);
66

7-
static __thread SynchPoolStruct pool_node CACHE_ALIGN;
7+
static _Thread_local SynchPoolStruct pool_node CACHE_ALIGN;
88

99
void CCQueueStructInit(CCQueueStruct *queue_object_struct, uint32_t nthreads) {
1010
CCSynchStructInit(&queue_object_struct->enqueue_struct, nthreads);

libconcurrent/concurrent/ccstack.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
static RetVal serialPushPop(void *state, ArgVal arg, int pid);
55

66
static const int POP_OP = INT_MIN;
7-
static __thread SynchPoolStruct pool_node CACHE_ALIGN;
7+
static _Thread_local SynchPoolStruct pool_node CACHE_ALIGN;
88

99
void CCStackInit(CCStackStruct *stack_object_struct, uint32_t nthreads) {
1010
CCSynchStructInit(&stack_object_struct->object_struct, nthreads);

libconcurrent/concurrent/dsmqueue.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
static RetVal serialEnqueue(void *state, ArgVal arg, int pid);
55
static RetVal serialDequeue(void *state, ArgVal arg, int pid);
66

7-
static __thread SynchPoolStruct pool_node CACHE_ALIGN;
7+
static _Thread_local SynchPoolStruct pool_node CACHE_ALIGN;
88

99
void DSMQueueStructInit(DSMQueueStruct *queue_object_struct, uint32_t nthreads) {
1010
DSMSynchStructInit(&queue_object_struct->enqueue_struct, nthreads);

libconcurrent/concurrent/dsmstack.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
static RetVal serialPushPop(void *state, ArgVal arg, int pid);
55

66
static const int POP_OP = INT_MIN;
7-
static __thread SynchPoolStruct pool_node CACHE_ALIGN;
7+
static _Thread_local SynchPoolStruct pool_node CACHE_ALIGN;
88

99
void DSMSStackInit(DSMStackStruct *stack_object_struct, uint32_t nthreads) {
1010
DSMSynchStructInit(&stack_object_struct->object_struct, nthreads);

libconcurrent/concurrent/fcqueue.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ static RetVal serialEnqueue(void *state, ArgVal arg, int pid);
88
static RetVal serialDequeue(void *state, ArgVal arg, int pid);
99

1010
static const int GUARD = INT_MIN;
11-
static __thread SynchPoolStruct pool_node CACHE_ALIGN;
11+
static _Thread_local SynchPoolStruct pool_node CACHE_ALIGN;
1212

1313
void FCQueueStructInit(FCQueueStruct *queue_object_struct, uint32_t nthreads) {
1414
FCStructInit(&queue_object_struct->enqueue_struct, nthreads);

libconcurrent/concurrent/fcstack.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#include <queue-stack.h>
66

77
static const int POP_OP = INT_MIN;
8-
static __thread SynchPoolStruct pool_node CACHE_ALIGN;
8+
static _Thread_local SynchPoolStruct pool_node CACHE_ALIGN;
99

1010
void FCStackInit(FCStackStruct *stack_object_struct, uint32_t nthreads) {
1111
FCStructInit(&stack_object_struct->object_struct, nthreads);

libconcurrent/concurrent/hqueue.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
static RetVal serialEnqueue(void *state, ArgVal arg, int pid);
55
static RetVal serialDequeue(void *state, ArgVal arg, int pid);
66

7-
static __thread SynchPoolStruct pool_node CACHE_ALIGN;
7+
static _Thread_local SynchPoolStruct pool_node CACHE_ALIGN;
88

99
void HQueueInit(HQueueStruct *queue_object_struct, uint32_t nthreads, uint32_t numa_nodes) {
1010
queue_object_struct->enqueue_struct = synchGetAlignedMemory(S_CACHE_LINE_SIZE, sizeof(HSynchStruct));

libconcurrent/concurrent/hstack.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
static RetVal serialPushPop(void *state, ArgVal arg, int pid);
55

66
static const int POP_OP = INT_MIN;
7-
static __thread SynchPoolStruct pool_node CACHE_ALIGN;
7+
static _Thread_local SynchPoolStruct pool_node CACHE_ALIGN;
88

99
void HStackInit(HStackStruct *stack_object_struct, uint32_t nthreads, uint32_t numa_nodes) {
1010
HSynchStructInit(&stack_object_struct->object_struct, nthreads, numa_nodes);

0 commit comments

Comments
 (0)