| OLD | NEW |
| 1 // Copyright (c) 2014, the Dartino project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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_POSIX) | 5 #if defined(DARTINO_TARGET_OS_POSIX) |
| 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 <errno.h> | 9 #include <errno.h> |
| 10 #include <stdio.h> | 10 #include <stdio.h> |
| 11 #include <sys/time.h> | 11 #include <sys/time.h> |
| 12 | 12 |
| 13 #include "src/shared/platform.h" | 13 #include "src/shared/platform.h" |
| 14 #include "src/shared/utils.h" | 14 #include "src/shared/utils.h" |
| 15 | 15 |
| 16 #include "src/vm/tick_sampler.h" | 16 #include "src/vm/tick_sampler.h" |
| 17 | 17 |
| 18 namespace fletch { | 18 namespace dartino { |
| 19 | 19 |
| 20 bool Thread::IsCurrent(const ThreadIdentifier* thread) { | 20 bool Thread::IsCurrent(const ThreadIdentifier* thread) { |
| 21 return thread->IsSelf(); | 21 return thread->IsSelf(); |
| 22 } | 22 } |
| 23 | 23 |
| 24 static pthread_key_t thr_id_key; | 24 static pthread_key_t thr_id_key; |
| 25 | 25 |
| 26 void Thread::SetProcess(Process* process) { | 26 void Thread::SetProcess(Process* process) { |
| 27 pthread_setspecific(thr_id_key, static_cast<void*>(process)); | 27 pthread_setspecific(thr_id_key, static_cast<void*>(process)); |
| 28 } | 28 } |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 if (result == EAGAIN) { | 73 if (result == EAGAIN) { |
| 74 Print::Error("Insufficient resources\n"); | 74 Print::Error("Insufficient resources\n"); |
| 75 } else { | 75 } else { |
| 76 Print::Error("Error %d", result); | 76 Print::Error("Error %d", result); |
| 77 } | 77 } |
| 78 FATAL1("pthread_create failed with error %d\n", result); | 78 FATAL1("pthread_create failed with error %d\n", result); |
| 79 } | 79 } |
| 80 return ThreadIdentifier(thread); | 80 return ThreadIdentifier(thread); |
| 81 } | 81 } |
| 82 | 82 |
| 83 } // namespace fletch | 83 } // namespace dartino |
| 84 | 84 |
| 85 #endif // defined(FLETCH_TARGET_OS_POSIX) | 85 #endif // defined(DARTINO_TARGET_OS_POSIX) |
| OLD | NEW |