summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2019-02-13 13:21:24 +0000
committerDmitry Vyukov <dvyukov@google.com>2019-02-13 13:21:24 +0000
commit00d38a06e40df0bb8fbc1d3e4e6a3cc35bddbd74 (patch)
treecaf5fc8a7574a520d89dcd38226629bae4581a81 /include
parentd1c6c0ed4f0794a32791f6b67d1c9b5f8cbcce47 (diff)
downloadcompiler-rt-00d38a06e40df0bb8fbc1d3e4e6a3cc35bddbd74.tar.gz
tsan: add fiber support This patch adds functions for managing fibers: __tsan_get_current_fiber() __tsan_create_fiber() __tsan_destroy_fiber() __tsan_switch_to_fiber() __tsan_set_fiber_name() See the added tests for use examples. Author: yuri (Yuri Per) Reviewed in: https://reviews.llvm.org/D54889 [The previous commit of this change was reverted, this is a resubmit with a squashed fix for check_analyze.sh and COMMON_INTERCEPTOR_NOTHING_IS_INITIALIZED] git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@353947 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/sanitizer/tsan_interface.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/sanitizer/tsan_interface.h b/include/sanitizer/tsan_interface.h
index 4a98a4e12..011b23350 100644
--- a/include/sanitizer/tsan_interface.h
+++ b/include/sanitizer/tsan_interface.h
@@ -136,6 +136,24 @@ void __tsan_external_assign_tag(void *addr, void *tag);
void __tsan_external_read(void *addr, void *caller_pc, void *tag);
void __tsan_external_write(void *addr, void *caller_pc, void *tag);
+// Fiber switching API.
+// - TSAN context for fiber can be created by __tsan_create_fiber
+// and freed by __tsan_destroy_fiber.
+// - TSAN context of current fiber or thread can be obtained
+// by calling __tsan_get_current_fiber.
+// - __tsan_switch_to_fiber should be called immediatly before switch
+// to fiber, such as call of swapcontext.
+// - Fiber name can be set by __tsan_set_fiber_name.
+void *__tsan_get_current_fiber(void);
+void *__tsan_create_fiber(unsigned flags);
+void __tsan_destroy_fiber(void *fiber);
+void __tsan_switch_to_fiber(void *fiber, unsigned flags);
+void __tsan_set_fiber_name(void *fiber, const char *name);
+
+// Flags for __tsan_switch_to_fiber:
+// Do not establish a happens-before relation between fibers
+const unsigned __tsan_switch_to_fiber_no_sync = 1 << 0;
+
#ifdef __cplusplus
} // extern "C"
#endif