OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/base/platform/platform.h" | 5 #include "src/base/platform/platform.h" |
6 | 6 |
7 #if V8_OS_POSIX | 7 #if V8_OS_POSIX |
8 #include <unistd.h> // NOLINT | 8 #include <unistd.h> // NOLINT |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 19 matching lines...) Expand all Loading... |
30 | 30 |
31 TEST(OS, NumberOfProcessorsOnline) { | 31 TEST(OS, NumberOfProcessorsOnline) { |
32 EXPECT_GT(OS::NumberOfProcessorsOnline(), 0); | 32 EXPECT_GT(OS::NumberOfProcessorsOnline(), 0); |
33 } | 33 } |
34 | 34 |
35 | 35 |
36 namespace { | 36 namespace { |
37 | 37 |
38 class SelfJoinThread V8_FINAL : public Thread { | 38 class SelfJoinThread V8_FINAL : public Thread { |
39 public: | 39 public: |
40 SelfJoinThread() : Thread("SelfJoinThread") {} | 40 SelfJoinThread() : Thread(Options("SelfJoinThread")) {} |
41 virtual void Run() V8_OVERRIDE { Join(); } | 41 virtual void Run() V8_OVERRIDE { Join(); } |
42 }; | 42 }; |
43 | 43 |
44 } | 44 } |
45 | 45 |
46 | 46 |
47 TEST(Thread, SelfJoin) { | 47 TEST(Thread, SelfJoin) { |
48 SelfJoinThread thread; | 48 SelfJoinThread thread; |
49 thread.Start(); | 49 thread.Start(); |
50 thread.Join(); | 50 thread.Join(); |
51 } | 51 } |
52 | 52 |
53 | 53 |
54 namespace { | 54 namespace { |
55 | 55 |
56 class ThreadLocalStorageTest : public Thread, public ::testing::Test { | 56 class ThreadLocalStorageTest : public Thread, public ::testing::Test { |
57 public: | 57 public: |
58 ThreadLocalStorageTest() : Thread("ThreadLocalStorageTest") { | 58 ThreadLocalStorageTest() : Thread(Options("ThreadLocalStorageTest")) { |
59 for (size_t i = 0; i < ARRAY_SIZE(keys_); ++i) { | 59 for (size_t i = 0; i < ARRAY_SIZE(keys_); ++i) { |
60 keys_[i] = Thread::CreateThreadLocalKey(); | 60 keys_[i] = Thread::CreateThreadLocalKey(); |
61 } | 61 } |
62 } | 62 } |
63 ~ThreadLocalStorageTest() { | 63 ~ThreadLocalStorageTest() { |
64 for (size_t i = 0; i < ARRAY_SIZE(keys_); ++i) { | 64 for (size_t i = 0; i < ARRAY_SIZE(keys_); ++i) { |
65 Thread::DeleteThreadLocalKey(keys_[i]); | 65 Thread::DeleteThreadLocalKey(keys_[i]); |
66 } | 66 } |
67 } | 67 } |
68 | 68 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 | 106 |
107 | 107 |
108 TEST_F(ThreadLocalStorageTest, DoTest) { | 108 TEST_F(ThreadLocalStorageTest, DoTest) { |
109 Run(); | 109 Run(); |
110 Start(); | 110 Start(); |
111 Join(); | 111 Join(); |
112 } | 112 } |
113 | 113 |
114 } // namespace base | 114 } // namespace base |
115 } // namespace v8 | 115 } // namespace v8 |
OLD | NEW |