Revision: 20794
Author: [email protected]
Date: Wed Apr 16 11:31:39 2014 UTC
Log: LazyInstance should be thread safe by default.
The only ways we use this class require it, as multiple isolates can race
to initialize data structures. This showed up as intermittant failures on
nosnap build bots.
[email protected]
Review URL: https://codereview.chromium.org/238973004
http://code.google.com/p/v8/source/detail?r=20794
Modified:
/branches/bleeding_edge/src/lazy-instance.h
=======================================
--- /branches/bleeding_edge/src/lazy-instance.h Mon Aug 26 11:18:28 2013 UTC
+++ /branches/bleeding_edge/src/lazy-instance.h Wed Apr 16 11:31:39 2014 UTC
@@ -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 @@
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 @@
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 @@
template <typename T,
typename CreateTrait = DefaultCreateTrait<T>,
- typename InitOnceTrait = SingleThreadInitOnceTrait,
+ typename InitOnceTrait = ThreadSafeInitOnceTrait,
typename DestroyTrait = LeakyInstanceTrait<T> >
struct LazyDynamicInstance {
typedef LazyInstanceImpl<T, DynamicallyAllocatedInstanceTrait<T>,
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.