Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(836)

Unified Diff: webrtc/system_wrappers/include/static_instance.h

Issue 2890213002: Prevent data race in GetStaticInstance (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/system_wrappers/include/static_instance.h
diff --git a/webrtc/system_wrappers/include/static_instance.h b/webrtc/system_wrappers/include/static_instance.h
index e9bf81d951ebec749aca5a7d8dc303bbf6b06d84..ad87fe68299ee051f95d9e200a0a0b867a530b4f 100644
--- a/webrtc/system_wrappers/include/static_instance.h
+++ b/webrtc/system_wrappers/include/static_instance.h
@@ -40,7 +40,7 @@ static T* GetStaticInstance(CountOperation count_operation) {
static T* volatile instance = NULL;
CreateOperation state = kInstanceExists;
#ifndef _WIN32
- rtc::CriticalSection crit_sect;
+ static rtc::CriticalSection crit_sect;
rtc::CritScope lock(&crit_sect);
if (count_operation ==
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698