[clangd] Fix a data race in test code

Found by TSan, thanks bkramer for pointing this out.

git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@370758 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/clangd/unittests/TUSchedulerTests.cpp b/clangd/unittests/TUSchedulerTests.cpp
index 274c07f..ff28cbb 100644
--- a/clangd/unittests/TUSchedulerTests.cpp
+++ b/clangd/unittests/TUSchedulerTests.cpp
@@ -740,12 +740,14 @@
   // We should see errors from command-line parsing inside the main file.
   CDB.ExtraClangFlags = {"-fsome-unknown-flag"};
 
+  // (!) 'Ready' must live longer than TUScheduler.
+  Notification Ready;
+
   TUScheduler S(CDB, /*AsyncThreadsCount=*/getDefaultAsyncThreadsCount(),
                 /*StorePreambleInMemory=*/true, /*ASTCallbacks=*/captureDiags(),
                 /*UpdateDebounce=*/std::chrono::steady_clock::duration::zero(),
                 ASTRetentionPolicy());
 
-  Notification Ready;
   std::vector<Diag> Diagnostics;
   updateWithDiags(S, testPath("foo.cpp"), "void test() {}",
                   WantDiagnostics::Yes, [&](std::vector<Diag> D) {