summaryrefslogtreecommitdiffstats
path: root/compiler-rt-fuzzer.patch
blob: 19575b70d3705f8facea403e5d3c0a1e21a1f280 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
--- llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp.orig	2019-02-13 14:24:24.239239031 -0600
+++ llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp	2019-02-13 14:28:18.525530281 -0600
@@ -248,13 +248,16 @@
   Command Cmd(Args);
   Cmd.removeFlag("jobs");
   Cmd.removeFlag("workers");
-  Vector<std::thread> V;
+  Vector<std::shared_ptr<std::thread>> V;
   std::thread Pulse(PulseThread);
   Pulse.detach();
-  for (unsigned i = 0; i < NumWorkers; i++)
-    V.push_back(std::thread(WorkerThread, std::ref(Cmd), &Counter, NumJobs, &HasErrors));
+  for (unsigned i = 0; i < NumWorkers; i++) {
+    std::shared_ptr<std::thread> wt(new std::thread(WorkerThread, std::ref(Cmd), &Counter, NumJobs, &HasErrors));
+    V.push_back(wt);
+  }
   for (auto &T : V)
-    T.join();
+    T->join();
+  Vector<std::shared_ptr<std::thread>>().swap(V);
   return HasErrors ? 1 : 0;
 }