diff --git a/compiler-rt/test/tsan/Linux/dlopen_static_tls.cpp b/compiler-rt/test/tsan/Linux/dlopen_static_tls.cpp --- a/compiler-rt/test/tsan/Linux/dlopen_static_tls.cpp +++ b/compiler-rt/test/tsan/Linux/dlopen_static_tls.cpp @@ -49,6 +49,7 @@ barrier_wait(&barrier); if (__atomic_load_n(&ready, __ATOMIC_ACQUIRE)) func(); + barrier_wait(&barrier); if (dlclose(lib)) { printf("error in dlclose: %s\n", dlerror()); exit(1); @@ -73,6 +74,7 @@ __atomic_store_n(&ready, 1, __ATOMIC_RELEASE); barrier_wait(&barrier); func(); + barrier_wait(&barrier); pthread_join(th, 0); fprintf(stderr, "DONE\n"); return 0;