From e3d5a117a3e0f795a038b8e2c167399b4b662168 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 27 May 2022 17:05:23 -0600 Subject: [PATCH] [hb-shape-threads] Fix tsan race --- test/threads/hb-shape-threads.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/threads/hb-shape-threads.cc b/test/threads/hb-shape-threads.cc index f4c8e1d0a..bc74b7289 100644 --- a/test/threads/hb-shape-threads.cc +++ b/test/threads/hb-shape-threads.cc @@ -161,7 +161,10 @@ static void test_backend (backend_t backend, for (unsigned i = 0; i < num_threads; i++) threads.push_back (std::thread (shape, variable, backend, test_input)); - ready = true; + { + std::unique_lock lk (cv_m); + ready = true; + } cv.notify_all(); for (unsigned i = 0; i < num_threads; i++)