[compiler-rt] [TSAN] Add __tsan_check_no_mutexes_held helper (PR #69372)
Dmitry Vyukov via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 23 22:41:59 PDT 2023
================
@@ -0,0 +1,19 @@
+// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
+#include "test.h"
+
+pthread_mutex_t mtx;
+
+void *ThreadFunc(void *) {
+ pthread_mutex_lock(&mtx);
+ pthread_mutex_unlock(&mtx);
+ __tsan_check_no_mutexes_held();
+}
+
+int main() {
+ pthread_t th;
+ pthread_create(&th, 0, ThreadFunc, NULL);
----------------
dvyukov wrote:
Creating threads does not look necessary in these tests.
https://github.com/llvm/llvm-project/pull/69372
More information about the llvm-commits
mailing list