File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88#ifndef FMT_FORMAT_INL_H_
99#define FMT_FORMAT_INL_H_
1010
11+ #ifdef __SANITIZE_THREAD__
12+ extern " C" void __tsan_acquire (void *);
13+ extern " C" void __tsan_release (void *);
14+ #endif
15+
1116#ifndef FMT_MODULE
1217# include < stddef.h> // ptrdiff_t
1318
@@ -1696,6 +1701,9 @@ class file_print_buffer<F, enable_if_t<has_flockfile<F>::value>>
16961701 public:
16971702 explicit file_print_buffer (F* f) : buffer(grow, size_t ()), file_(f) {
16981703 flockfile (f);
1704+ #ifdef __SANITIZE_THREAD__
1705+ __tsan_acquire (f);
1706+ #endif
16991707 file_.init_buffer ();
17001708 auto buf = file_.get_write_buffer ();
17011709 set (buf.data , buf.size );
@@ -1705,6 +1713,9 @@ class file_print_buffer<F, enable_if_t<has_flockfile<F>::value>>
17051713 bool flush = file_.needs_flush ();
17061714 F* f = file_; // Make funlockfile depend on the template parameter F
17071715 funlockfile (f); // for the system API detection to work.
1716+ #ifdef __SANITIZE_THREAD__
1717+ __tsan_release (f);
1718+ #endif
17081719 if (flush) fflush (file_);
17091720 }
17101721};
You can’t perform that action at this time.
0 commit comments