From 63802cddc19436df8c5f2d3243c93b243f9800c7 Mon Sep 17 00:00:00 2001 From: "mvstanton@chromium.org" Date: Wed, 16 Apr 2014 11:31:39 +0000 Subject: [PATCH] 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. R=hpayer@chromium.org Review URL: https://codereview.chromium.org/238973004 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20794 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/lazy-instance.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/lazy-instance.h b/src/lazy-instance.h index fc03f4d..ccf8b66 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 InitOnceTrait = SingleThreadInitOnceTrait, + typename InitOnceTrait = ThreadSafeInitOnceTrait, typename DestroyTrait = LeakyInstanceTrait > struct LazyStaticInstance { typedef LazyInstanceImpl, @@ -237,7 +237,7 @@ struct LazyStaticInstance { template , - typename InitOnceTrait = SingleThreadInitOnceTrait, + typename InitOnceTrait = ThreadSafeInitOnceTrait, typename DestroyTrait = LeakyInstanceTrait > struct LazyInstance { // A LazyInstance is a LazyStaticInstance. @@ -248,7 +248,7 @@ struct LazyInstance { template , - typename InitOnceTrait = SingleThreadInitOnceTrait, + typename InitOnceTrait = ThreadSafeInitOnceTrait, typename DestroyTrait = LeakyInstanceTrait > struct LazyDynamicInstance { typedef LazyInstanceImpl, -- 2.7.4