Skip to content

Commit

Permalink
fix: annotate static variable in VLOG_IS_ON (#890)
Browse files Browse the repository at this point in the history
Avoid TSAN issues when multiple threads perform the check.
  • Loading branch information
Deev Patel authored Oct 7, 2023
1 parent f6e4d96 commit e17f932
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/glog/vlog_is_on.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@
#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, \
__FILE__, verbose_level__) : *vlocal__.level >= verbose_level__); \
Expand Down

0 comments on commit e17f932

Please sign in to comment.