| OLD | NEW |
| 1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
| 4 | 4 |
| 5 #if defined(FLETCH_TARGET_OS_WIN) | 5 #if defined(DARTINO_TARGET_OS_WIN) |
| 6 | 6 |
| 7 #include "src/vm/thread.h" // NOLINT we don't include thread_posix.h. | 7 #include "src/vm/thread.h" // NOLINT we don't include thread_posix.h. |
| 8 | 8 |
| 9 #include "src/shared/platform.h" | 9 #include "src/shared/platform.h" |
| 10 #include "src/shared/utils.h" | 10 #include "src/shared/utils.h" |
| 11 | 11 |
| 12 namespace fletch { | 12 namespace dartino { |
| 13 | 13 |
| 14 static const int kFletchStackSize = 4096; | 14 static const int kDartinoStackSize = 4096; |
| 15 | 15 |
| 16 void Thread::SetProcess(Process* process) { | 16 void Thread::SetProcess(Process* process) { |
| 17 // Unused since tick sample is not available on Windows. | 17 // Unused since tick sample is not available on Windows. |
| 18 } | 18 } |
| 19 | 19 |
| 20 Process* Thread::GetProcess() { | 20 Process* Thread::GetProcess() { |
| 21 // Unused since tick sample is not available on Windows. | 21 // Unused since tick sample is not available on Windows. |
| 22 return NULL; | 22 return NULL; |
| 23 } | 23 } |
| 24 | 24 |
| 25 bool Thread::IsCurrent(const ThreadIdentifier* thread) { | 25 bool Thread::IsCurrent(const ThreadIdentifier* thread) { |
| 26 return thread->IsSelf(); | 26 return thread->IsSelf(); |
| 27 } | 27 } |
| 28 | 28 |
| 29 void Thread::Setup() {} | 29 void Thread::Setup() {} |
| 30 | 30 |
| 31 void Thread::TearDown() {} | 31 void Thread::TearDown() {} |
| 32 | 32 |
| 33 void Thread::SetupOSSignals() { | 33 void Thread::SetupOSSignals() { |
| 34 // Platform doesn't have signals. | 34 // Platform doesn't have signals. |
| 35 } | 35 } |
| 36 | 36 |
| 37 void Thread::TeardownOSSignals() { | 37 void Thread::TeardownOSSignals() { |
| 38 // Platform doesn't have signals. | 38 // Platform doesn't have signals. |
| 39 } | 39 } |
| 40 | 40 |
| 41 ThreadIdentifier Thread::Run(RunSignature run, void* data) { | 41 ThreadIdentifier Thread::Run(RunSignature run, void* data) { |
| 42 HANDLE thread = CreateThread(NULL, kFletchStackSize, | 42 HANDLE thread = CreateThread(NULL, kDartinoStackSize, |
| 43 reinterpret_cast<LPTHREAD_START_ROUTINE>(run), | 43 reinterpret_cast<LPTHREAD_START_ROUTINE>(run), |
| 44 data, 0, NULL); | 44 data, 0, NULL); |
| 45 if (thread == NULL) { | 45 if (thread == NULL) { |
| 46 FATAL("CreateThread failed\n"); | 46 FATAL("CreateThread failed\n"); |
| 47 } | 47 } |
| 48 return ThreadIdentifier(thread); | 48 return ThreadIdentifier(thread); |
| 49 } | 49 } |
| 50 | 50 |
| 51 } // namespace fletch | 51 } // namespace dartino |
| 52 | 52 |
| 53 #endif // defined(FLETCH_TARGET_OS_WIN) | 53 #endif // defined(DARTINO_TARGET_OS_WIN) |
| OLD | NEW |