Skip to content

Commit 90785f2

Browse files
Backport fence strengthening from qthreads development version. Surprisingly this appears to improve performance.
Signed-off-by: Ian Henriksen <[email protected]>
1 parent 26f056e commit 90785f2

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

third-party/qthread/README

+13
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,16 @@ index 2ac887ed..2312c954 100644
102102
pthread_exit(NULL);
103103
```
104104

105+
```
106+
--- a/include/qthread/qthread.h
107+
+++ b/include/qthread/qthread.h
108+
@@ -87,7 +87,7 @@ using std::memory_order_relaxed;
109+
110+
#include "macros.h"
111+
112+
-#define MACHINE_FENCE atomic_thread_fence(memory_order_acq_rel);
113+
+#define MACHINE_FENCE atomic_thread_fence(memory_order_seq_cst);
114+
115+
#if QTHREAD_ASSEMBLY_ARCH == QTHREAD_AMD64
116+
#define QTHREAD_SWAPS_IMPLY_ACQ_REL_FENCES
117+
```

third-party/qthread/qthread-src/include/qthread/qthread.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ using std::memory_order_relaxed;
8787

8888
#include "macros.h"
8989

90-
#define MACHINE_FENCE atomic_thread_fence(memory_order_acq_rel);
90+
#define MACHINE_FENCE atomic_thread_fence(memory_order_seq_cst);
9191

9292
#if QTHREAD_ASSEMBLY_ARCH == QTHREAD_AMD64
9393
#define QTHREAD_SWAPS_IMPLY_ACQ_REL_FENCES

0 commit comments

Comments
 (0)