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

Unified Diff: src/lazy-instance.h

Issue 238973004: LazyInstance should be thread safe by default. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebase. Created 6 years, 8 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: src/lazy-instance.h
diff --git a/src/lazy-instance.h b/src/lazy-instance.h
index fc03f4d126025070fb490073ff9984446d68af3c..ccf8b66401c62b1523a9a86224cdb2f3c5444632 100644
--- a/src/lazy-instance.h
+++ b/src/lazy-instance.h
@@ -66,8 +66,8 @@
// LAZY_INSTANCE_INITIALIZER;
//
// WARNINGS:
-// - This implementation of LazyInstance is NOT THREAD-SAFE by default. See
-// ThreadSafeInitOnceTrait declared below for that.
+// - This implementation of LazyInstance IS THREAD-SAFE by default. See
+// SingleThreadInitOnceTrait if you don't care about thread safety.
// - Lazy initialization comes with a cost. Make sure that you don't use it on
// critical path. Consider adding your initialization code to a function
// which is explicitly called once.
@@ -227,7 +227,7 @@ struct LazyInstanceImpl {
template <typename T,
typename CreateTrait = DefaultConstructTrait<T>,
- typename InitOnceTrait = SingleThreadInitOnceTrait,
+ typename InitOnceTrait = ThreadSafeInitOnceTrait,
typename DestroyTrait = LeakyInstanceTrait<T> >
struct LazyStaticInstance {
typedef LazyInstanceImpl<T, StaticallyAllocatedInstanceTrait<T>,
@@ -237,7 +237,7 @@ struct LazyStaticInstance {
template <typename T,
typename CreateTrait = DefaultConstructTrait<T>,
- typename InitOnceTrait = SingleThreadInitOnceTrait,
+ typename InitOnceTrait = ThreadSafeInitOnceTrait,
typename DestroyTrait = LeakyInstanceTrait<T> >
struct LazyInstance {
// A LazyInstance is a LazyStaticInstance.
@@ -248,7 +248,7 @@ struct LazyInstance {
template <typename T,
typename CreateTrait = DefaultCreateTrait<T>,
- typename InitOnceTrait = SingleThreadInitOnceTrait,
+ typename InitOnceTrait = ThreadSafeInitOnceTrait,
typename DestroyTrait = LeakyInstanceTrait<T> >
struct LazyDynamicInstance {
typedef LazyInstanceImpl<T, DynamicallyAllocatedInstanceTrait<T>,
« 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