Commit 509999ec authored by Dan Melnic's avatar Dan Melnic Committed by Facebook Github Bot

Add annotate_ignore_thread_sanitizer_guard class

Summary:
Add `annotate_ignore_thread_sanitizer_guard` class.

(Note: this ignores all push blocking failures!)

Reviewed By: yfeldblum

Differential Revision: D18045913

fbshipit-source-id: 39113e8df3deef3374a3c44246bc55a156bc4d8d
parent 023744f6
...@@ -77,15 +77,8 @@ class AtForkList { ...@@ -77,15 +77,8 @@ class AtForkList {
// so we just enable ignores for everything // so we just enable ignores for everything
// while handling the child callbacks // while handling the child callbacks
// This might still be an issue if we do not exec right away // This might still be an issue if we do not exec right away
annotate_ignore_reads_begin(__FILE__, __LINE__); annotate_ignore_thread_sanitizer_guard g(__FILE__, __LINE__);
annotate_ignore_writes_begin(__FILE__, __LINE__);
annotate_ignore_sync_begin(__FILE__, __LINE__);
auto reenableAnnotationsGuard = folly::makeGuard([] {
annotate_ignore_reads_end(__FILE__, __LINE__);
annotate_ignore_writes_end(__FILE__, __LINE__);
annotate_ignore_sync_end(__FILE__, __LINE__);
});
auto& tasks = instance().tasks; auto& tasks = instance().tasks;
for (auto& task : tasks) { for (auto& task : tasks) {
task.child(); task.child();
......
...@@ -189,4 +189,30 @@ FOLLY_ALWAYS_INLINE static void annotate_ignore_sync_end(const char* f, int l) { ...@@ -189,4 +189,30 @@ FOLLY_ALWAYS_INLINE static void annotate_ignore_sync_end(const char* f, int l) {
detail::annotate_ignore_sync_end_impl(f, l); detail::annotate_ignore_sync_end_impl(f, l);
} }
} }
class annotate_ignore_thread_sanitizer_guard {
public:
annotate_ignore_thread_sanitizer_guard(const char* file, int line)
: file_(file), line_(line) {
annotate_ignore_reads_begin(file_, line_);
annotate_ignore_writes_begin(file_, line_);
annotate_ignore_sync_begin(file_, line_);
}
annotate_ignore_thread_sanitizer_guard(
const annotate_ignore_thread_sanitizer_guard&) = delete;
annotate_ignore_thread_sanitizer_guard& operator=(
const annotate_ignore_thread_sanitizer_guard&) = delete;
~annotate_ignore_thread_sanitizer_guard() {
annotate_ignore_reads_end(file_, line_);
annotate_ignore_writes_end(file_, line_);
annotate_ignore_sync_end(file_, line_);
}
private:
const char* file_;
int line_;
};
} // namespace folly } // namespace folly
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment