| 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 18 matching lines...) Expand all Loading... |
| 29 | 29 |
| 30 | 30 |
| 31 namespace { | 31 namespace { |
| 32 | 32 |
| 33 class SelfJoinThread V8_FINAL : public Thread { | 33 class SelfJoinThread V8_FINAL : public Thread { |
| 34 public: | 34 public: |
| 35 SelfJoinThread() : Thread(Options("SelfJoinThread")) {} | 35 SelfJoinThread() : Thread(Options("SelfJoinThread")) {} |
| 36 virtual void Run() V8_OVERRIDE { Join(); } | 36 virtual void Run() V8_OVERRIDE { Join(); } |
| 37 }; | 37 }; |
| 38 | 38 |
| 39 } | 39 } // namespace |
| 40 | 40 |
| 41 | 41 |
| 42 TEST(Thread, SelfJoin) { | 42 TEST(Thread, SelfJoin) { |
| 43 SelfJoinThread thread; | 43 SelfJoinThread thread; |
| 44 thread.Start(); | 44 thread.Start(); |
| 45 thread.Join(); | 45 thread.Join(); |
| 46 } | 46 } |
| 47 | 47 |
| 48 | 48 |
| 49 namespace { | 49 namespace { |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 } | 90 } |
| 91 | 91 |
| 92 private: | 92 private: |
| 93 static void* GetValue(size_t x) { | 93 static void* GetValue(size_t x) { |
| 94 return reinterpret_cast<void*>(static_cast<uintptr_t>(x + 1)); | 94 return reinterpret_cast<void*>(static_cast<uintptr_t>(x + 1)); |
| 95 } | 95 } |
| 96 | 96 |
| 97 Thread::LocalStorageKey keys_[256]; | 97 Thread::LocalStorageKey keys_[256]; |
| 98 }; | 98 }; |
| 99 | 99 |
| 100 } | 100 } // namespace |
| 101 | 101 |
| 102 | 102 |
| 103 TEST_F(ThreadLocalStorageTest, DoTest) { | 103 TEST_F(ThreadLocalStorageTest, DoTest) { |
| 104 Run(); | 104 Run(); |
| 105 Start(); | 105 Start(); |
| 106 Join(); | 106 Join(); |
| 107 } | 107 } |
| 108 | 108 |
| 109 } // namespace base | 109 } // namespace base |
| 110 } // namespace v8 | 110 } // namespace v8 |
| OLD | NEW |