[PATCH] D70910: [compiler-rt] Add a critical section when flushing gcov counters
calixte via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 3 01:23:18 PST 2019
calixte updated this revision to Diff 231843.
calixte added a comment.
Use SRWLock instead of a CRITICAL_SECTION.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D70910/new/
https://reviews.llvm.org/D70910
Files:
compiler-rt/lib/profile/GCDAProfiling.c
Index: compiler-rt/lib/profile/GCDAProfiling.c
===================================================================
--- compiler-rt/lib/profile/GCDAProfiling.c
+++ compiler-rt/lib/profile/GCDAProfiling.c
@@ -74,23 +74,12 @@
static __inline void gcov_flush_init_once(void) {}
#else
#include <windows.h>
-static CRITICAL_SECTION gcov_flush_mutex;
+static SRWLOCK gcov_flush_mutex = SRWLOCK_INIT;
static __inline void gcov_flush_lock() {
- EnterCriticalSection(&gcov_flush_mutex);
+ AcquireSRWLockExclusive(&gcov_flush_mutex);
}
static __inline void gcov_flush_unlock() {
- LeaveCriticalSection(&gcov_flush_mutex);
-}
-static __inline void gcov_flush_exit(void) {
- DeleteCriticalSection(&gcov_flush_mutex);
-}
-static __inline void gcov_flush_init(void) {
- InitializeCriticalSection(&gcov_flush_mutex);
- atexit(&gcov_flush_exit);
-}
-static __inline void gcov_flush_init_once(void) {
- static INIT_ONCE once;
- InitOnceExecuteOnce(&once, gcov_flush_init, NULL, NULL);
+ ReleaseSRWLockExclusive(&gcov_flush_mutex);
}
#endif
@@ -651,7 +640,6 @@
}
void __gcov_flush() {
- gcov_flush_init_once();
gcov_flush_lock();
struct fn_node* curr = flush_fn_list.head;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70910.231843.patch
Type: text/x-patch
Size: 1186 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191203/f876de9b/attachment.bin>
More information about the llvm-commits
mailing list