forked from golang/glog
-
Notifications
You must be signed in to change notification settings - Fork 214
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The way it was implemented before, the current value of several flags was written to the global config struct each time InitFlags was called. Not all flags may get written concurrently, so this led to a data race when some other goroutine was actively using klog. InitFlags also created new flag.Flag instances for each call. By creating flags once during init, InitFlags becomes entirely read-only and thus safe to use concurrently. What remains ambiguous is which flags may get changed at runtime. That was underspecified before and doesn't get fixed here either, it just gets called out as a potential problem.
- Loading branch information
Showing
1 changed file
with
29 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters