[PATCH] tsan: do not deadlock on fork

Kostya Serebryany kcc at google.com
Fri Jan 24 03:55:32 PST 2014


  (more to follow)


================
Comment at: lib/tsan/lit_tests/fork_deadlock.cc:20
@@ +19,3 @@
+  sleep(100);
+  fprintf(stderr, "timed out after 10 seconds\n");
+  exit(1);
----------------
sleep(100) but "after 10 seconds"

================
Comment at: lib/tsan/lit_tests/fork_deadlock.cc:27
@@ +26,3 @@
+  pthread_t th;
+  pthread_create(&th, 0, incrementer, 0);
+  pthread_create(&th, 0, watchdog, 0);
----------------
you are using 'th' twice (probably still works, but confusing)

================
Comment at: lib/tsan/lit_tests/fork_multithreaded2.cc:1
@@ +1,2 @@
+// RUN: %clangxx_tsan -O1 %s -o %t && TSAN_OPTIONS="die_after_fork=0" %t 2>&1 | FileCheck %s
+#include <stdlib.h>
----------------
can't you merge this test with fork_multithreaded.cc ? 
Just have two RUN: lines and use FileCheck --check-prefix=CHECK-FOO


http://llvm-reviews.chandlerc.com/D2614



More information about the llvm-commits mailing list