summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/tsan/go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2012-07-16 16:01:08 +0000
committerDmitry Vyukov <dvyukov@google.com>2012-07-16 16:01:08 +0000
commit9270eaf1f24357764dda6cc70196a3fb03bfbb2b (patch)
tree71d947c230246467bbe8c03949b0ad906e58d0a9 /compiler-rt/lib/tsan/go
parent1206a911552b65e26491c0ed59cc1d455f3a4048 (diff)
downloadbcm5719-llvm-9270eaf1f24357764dda6cc70196a3fb03bfbb2b.tar.gz
bcm5719-llvm-9270eaf1f24357764dda6cc70196a3fb03bfbb2b.zip
tsan: Go runtime: support goroutine end event
llvm-svn: 160282
Diffstat (limited to 'compiler-rt/lib/tsan/go')
-rw-r--r--compiler-rt/lib/tsan/go/test.c5
-rw-r--r--compiler-rt/lib/tsan/go/tsan_go.cc6
2 files changed, 11 insertions, 0 deletions
diff --git a/compiler-rt/lib/tsan/go/test.c b/compiler-rt/lib/tsan/go/test.c
index c27a94adf58..c6c21a165bd 100644
--- a/compiler-rt/lib/tsan/go/test.c
+++ b/compiler-rt/lib/tsan/go/test.c
@@ -2,6 +2,7 @@
void __tsan_init();
void __tsan_fini();
+void __tsan_event(int typ, int tid, void *pc, void *addr, int info);
int goCallbackCommentPc(void *pc, char **img, char **rtn, char **file, int *l) {
return 0;
@@ -9,6 +10,10 @@ int goCallbackCommentPc(void *pc, char **img, char **rtn, char **file, int *l) {
int main(void) {
__tsan_init();
+ __tsan_event(1, 0, 0, &main, 0); // READ
+ __tsan_event(11, 1, 0, 0, 0); // THR_START
+ __tsan_event(11, 0, 0, &main, 0); // READ
+ __tsan_event(13, 1, 0, 0, 0); // THR_END
printf("OK\n");
__tsan_fini();
return 0;
diff --git a/compiler-rt/lib/tsan/go/tsan_go.cc b/compiler-rt/lib/tsan/go/tsan_go.cc
index 13cc569fbd0..de69709ef51 100644
--- a/compiler-rt/lib/tsan/go/tsan_go.cc
+++ b/compiler-rt/lib/tsan/go/tsan_go.cc
@@ -210,6 +210,12 @@ void __tsan_event(int typ, int tid, void *pc, void *addr, int info) {
thr->in_rtl--;
break;
}
+ case THR_END: {
+ thr->in_rtl++;
+ ThreadFinish(thr);
+ thr->in_rtl--;
+ break;
+ }
default:
Printf("Unknown event type %d\n", typ);
Die();
OpenPOWER on IntegriCloud