[PATCH] D54664: [tsan] Add __cxa_guard_acquire hooks to support cooperative scheduling

Dmitry Vyukov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 17 09:28:17 PST 2018


dvyukov added inline comments.


================
Comment at: compiler-rt/lib/tsan/rtl/tsan_interceptors.cc:234
+#ifdef TSAN_EXTERNAL_HOOKS
+void OnCxaGuardAcquireEnter();
+void OnCxaGuardAcquireExit();
----------------
I think it will be better to call these annotations in a more generic way. Later we may need to use for other functions as well, e.g. phtread_mutex_lock. Internally we call them potentially_blocking_region_begin/end, so if we don't have better naming ideas we could just copy that.



================
Comment at: compiler-rt/lib/tsan/rtl/tsan_interceptors.cc:880
+  OnCxaGuardAcquireEnter();
+  auto on_exit = at_scope_exit(&OnCxaGuardAcquireExit);
   for (;;) {
----------------
For my education, why can't at_scope_exit call the function 2 or 3 times? Can't it create 2 or 3 copies of RunOnDestruction, each of which will call the function?


Repository:
  rL LLVM

https://reviews.llvm.org/D54664





More information about the llvm-commits mailing list