Reviewers: Sven Panne,

Description:
CcTest::isolate_used_ is used from multiple threads, make it atomic

BUG=none
[email protected]
LOG=n

Please review this at https://codereview.chromium.org/637263003/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+4, -4 lines):
  M test/cctest/cctest.h
  M test/cctest/cctest.cc


Index: test/cctest/cctest.cc
diff --git a/test/cctest/cctest.cc b/test/cctest/cctest.cc
index f03710a3b0405e88ad21e76ccb7fdb6701eded2b..d6b1308086e0578e92bc73e6fdc75ab0ce1ec6a8 100644
--- a/test/cctest/cctest.cc
+++ b/test/cctest/cctest.cc
@@ -47,7 +47,7 @@ static bool disable_automatic_dispose_ = false;

 CcTest* CcTest::last_ = NULL;
 bool CcTest::initialize_called_ = false;
-bool CcTest::isolate_used_ = false;
+v8::base::Atomic32 CcTest::isolate_used_ = 0;
 v8::Isolate* CcTest::isolate_ = NULL;


Index: test/cctest/cctest.h
diff --git a/test/cctest/cctest.h b/test/cctest/cctest.h
index 6d27074a6f1beb55facc95d54e4497ef9b8a7e9c..4f078690e1d3bd81f0919bf6be30c97a827e193e 100644
--- a/test/cctest/cctest.h
+++ b/test/cctest/cctest.h
@@ -117,7 +117,7 @@ class CcTest {

   static v8::Isolate* isolate() {
     CHECK(isolate_ != NULL);
-    isolate_used_ = true;
+    v8::base::NoBarrier_Store(&isolate_used_, 1);
     return isolate_;
   }

@@ -149,7 +149,7 @@ class CcTest {
   // TODO(dcarney): Remove.
   // This must be called first in a test.
   static void InitializeVM() {
-    CHECK(!isolate_used_);
+    CHECK(!v8::base::NoBarrier_Load(&isolate_used_));
     CHECK(!initialize_called_);
     initialize_called_ = true;
     v8::HandleScope handle_scope(CcTest::isolate());
@@ -181,7 +181,7 @@ class CcTest {
   static CcTest* last_;
   static v8::Isolate* isolate_;
   static bool initialize_called_;
-  static bool isolate_used_;
+  static v8::base::Atomic32 isolate_used_;
 };

 // Switches between all the Api tests using the threading support.


--
--
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.

Reply via email to