Skip to content

Commit

Permalink
fix: annotate static variable in VLOG_IS_ON
Browse files Browse the repository at this point in the history
Avoid TSAN issues when multiple threads perform the check.
  • Loading branch information
pateldeev authored and sergiud committed Oct 7, 2023
1 parent f6e4d96 commit eb65d54
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/glog/vlog_is_on.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,10 @@
#define VLOG_IS_ON(verboselevel) \
__extension__ \
({ static @ac_google_namespace@::SiteFlag vlocal__ = {NULL, NULL, 0, NULL}; \
GLOG_IFDEF_THREAD_SANITIZER( \
AnnotateBenignRaceSized(__FILE__, __LINE__, &vlocal__, sizeof(@ac_google_namespace@::SiteFlag), "")); \
@ac_google_namespace@::int32 verbose_level__ = (verboselevel); \
(vlocal__.level == NULL ? @ac_google_namespace@::InitVLOG3__(&vlocal__, &FLAGS_v, \
(vlocal__.level == NULL ? (@ac_google_namespace@::InitVLOG3__)(&vlocal__, &FLAGS_v, \
__FILE__, verbose_level__) : *vlocal__.level >= verbose_level__); \
})
#else
Expand Down

0 comments on commit eb65d54

Please sign in to comment.