Browse Source

Modify STOP_FLAG_ASSING to make TSAN happy (#1333)

bel2125 2 months ago
parent
commit
a87a7aaffd
2 changed files with 4 additions and 1 deletions
  1. 1 0
      CREDITS.md
  2. 3 1
      src/civetweb.c

+ 1 - 0
CREDITS.md

@@ -130,6 +130,7 @@
 * Lammert Bies
 * Lars Immisch
 * Lawrence
+* Lev275568
 * Li Peng
 * Lianghui
 * Lorenzo Canepa

+ 3 - 1
src/civetweb.c

@@ -2339,7 +2339,9 @@ STOP_FLAG_ASSIGN(stop_flag_t *f, stop_flag_t v)
 {
 	stop_flag_t sf = 0;
 	do {
-		sf = mg_atomic_compare_and_swap(f, *f, v);
+		sf = mg_atomic_compare_and_swap(f,
+		                                __atomic_load_n(f, __ATOMIC_SEQ_CST),
+		                                v);
 	} while (sf != v);
 }