Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[tsan] Add __cxa_guard_acquire hooks to support cooperative scheduling
Reviewers: dvyukov Subscribers: krytarowski, kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D54664 llvm-svn: 347336
- Loading branch information
1 parent
368a199
commit afedb89
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// RUN: %clangxx_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s | ||
|
||
#include <stdio.h> | ||
|
||
namespace __tsan { | ||
|
||
void OnPotentiallyBlockingRegionBegin() { | ||
printf("Enter __cxa_guard_acquire\n"); | ||
} | ||
|
||
void OnPotentiallyBlockingRegionEnd() { printf("Exit __cxa_guard_acquire\n"); } | ||
|
||
} // namespace __tsan | ||
|
||
int main(int argc, char **argv) { | ||
// CHECK: Enter main | ||
printf("Enter main\n"); | ||
// CHECK-NEXT: Enter __cxa_guard_acquire | ||
// CHECK-NEXT: Exit __cxa_guard_acquire | ||
static int s = argc; | ||
(void)s; | ||
// CHECK-NEXT: Exit main | ||
printf("Exit main\n"); | ||
return 0; | ||
} |