[PATCH] D42862: [asan] Make concurrent_overflow.cc less flaky

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 2 11:51:11 PST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL324126: [asan] Make concurrent_overflow.cc less flaky (authored by kuba.brecka, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D42862?vs=132643&id=132646#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D42862

Files:
  compiler-rt/trunk/test/asan/TestCases/Posix/concurrent_overflow.cc


Index: compiler-rt/trunk/test/asan/TestCases/Posix/concurrent_overflow.cc
===================================================================
--- compiler-rt/trunk/test/asan/TestCases/Posix/concurrent_overflow.cc
+++ compiler-rt/trunk/test/asan/TestCases/Posix/concurrent_overflow.cc
@@ -20,11 +20,12 @@
 int main(void) {
   const int n_threads = 8;
   int i, counter = n_threads;
-  pthread_t thread;
+  pthread_t thread[n_threads];
 
   for (i = 0; i < n_threads; ++i)
-    pthread_create(&thread, NULL, &start_routine, (void *)&counter);
-  sleep(5);
+    pthread_create(&thread[i], NULL, &start_routine, (void *)&counter);
+  for (i = 0; i < n_threads; ++i)
+    pthread_join(thread[i], NULL);
   return 0;
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42862.132646.patch
Type: text/x-patch
Size: 716 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180202/efb11f13/attachment.bin>


More information about the llvm-commits mailing list