summaryrefslogtreecommitdiff
path: root/src/runtime
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2017-05-25 12:20:58 -0700
committerIan Lance Taylor <iant@golang.org>2017-05-26 05:22:39 +0000
commit6654e3e0a1fa1deff4acf7d5ea68cd078df7e2fa (patch)
treed7e80c6dd9388aa716cb6fe71b4ce6dc576eb8c8 /src/runtime
parentffab6ab87773e0d8c50f64a29555b0d529c1d43a (diff)
downloadgo-git-6654e3e0a1fa1deff4acf7d5ea68cd078df7e2fa.tar.gz
cmd/cgo, runtime/cgo: add docs for TSAN interaction
Change-Id: I3b3ae4ecad0894781a3019326c7262cb9790ad4d Reviewed-on: https://go-review.googlesource.com/44250 Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
Diffstat (limited to 'src/runtime')
-rw-r--r--src/runtime/cgo/libcgo.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/runtime/cgo/libcgo.h b/src/runtime/cgo/libcgo.h
index 01f9e72174..2b8b4e25a2 100644
--- a/src/runtime/cgo/libcgo.h
+++ b/src/runtime/cgo/libcgo.h
@@ -111,6 +111,11 @@ extern void (*(_cgo_get_context_function(void)))(struct context_arg*);
#ifdef CGO_TSAN
// These must match the definitions in yesTsanProlog in cmd/cgo/out.go.
+// In general we should call _cgo_tsan_acquire when we enter C code,
+// and call _cgo_tsan_release when we return to Go code.
+// This is only necessary when calling code that might be instrumented
+// by TSAN, which mostly means system library calls that TSAN intercepts.
+// See the comment in cmd/cgo/out.go for more details.
long long _cgo_sync __attribute__ ((common));