| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart 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 file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef VM_THREAD_H_ | 5 #ifndef VM_OS_THREAD_H_ |
| 6 #define VM_THREAD_H_ | 6 #define VM_OS_THREAD_H_ |
| 7 | 7 |
| 8 #include "platform/globals.h" | 8 #include "platform/globals.h" |
| 9 #include "vm/allocation.h" |
| 9 | 10 |
| 10 // Declare the OS-specific types ahead of defining the generic classes. | 11 // Declare the OS-specific types ahead of defining the generic classes. |
| 11 #if defined(TARGET_OS_ANDROID) | 12 #if defined(TARGET_OS_ANDROID) |
| 12 #include "vm/thread_android.h" | 13 #include "vm/os_thread_android.h" |
| 13 #elif defined(TARGET_OS_LINUX) | 14 #elif defined(TARGET_OS_LINUX) |
| 14 #include "vm/thread_linux.h" | 15 #include "vm/os_thread_linux.h" |
| 15 #elif defined(TARGET_OS_MACOS) | 16 #elif defined(TARGET_OS_MACOS) |
| 16 #include "vm/thread_macos.h" | 17 #include "vm/os_thread_macos.h" |
| 17 #elif defined(TARGET_OS_WINDOWS) | 18 #elif defined(TARGET_OS_WINDOWS) |
| 18 #include "vm/thread_win.h" | 19 #include "vm/os_thread_win.h" |
| 19 #else | 20 #else |
| 20 #error Unknown target os. | 21 #error Unknown target os. |
| 21 #endif | 22 #endif |
| 22 | 23 |
| 23 namespace dart { | 24 namespace dart { |
| 24 | 25 |
| 25 class Isolate; | 26 class Isolate; |
| 26 | 27 |
| 27 class Thread { | 28 // Low-level operations on OS platform threads. |
| 29 class OSThread : AllStatic { |
| 28 public: | 30 public: |
| 29 static ThreadLocalKey kUnsetThreadLocalKey; | 31 static ThreadLocalKey kUnsetThreadLocalKey; |
| 30 static ThreadId kInvalidThreadId; | 32 static ThreadId kInvalidThreadId; |
| 31 | 33 |
| 32 typedef void (*ThreadStartFunction) (uword parameter); | 34 typedef void (*ThreadStartFunction) (uword parameter); |
| 33 | 35 |
| 34 // Start a thread running the specified function. Returns 0 if the | 36 // Start a thread running the specified function. Returns 0 if the |
| 35 // thread started successfuly and a system specific error code if | 37 // thread started successfuly and a system specific error code if |
| 36 // the thread failed to start. | 38 // the thread failed to start. |
| 37 static int Start(ThreadStartFunction function, uword parameters); | 39 static int Start(ThreadStartFunction function, uword parameters); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 private: | 102 private: |
| 101 MonitorData data_; // OS-specific data. | 103 MonitorData data_; // OS-specific data. |
| 102 | 104 |
| 103 DISALLOW_COPY_AND_ASSIGN(Monitor); | 105 DISALLOW_COPY_AND_ASSIGN(Monitor); |
| 104 }; | 106 }; |
| 105 | 107 |
| 106 | 108 |
| 107 } // namespace dart | 109 } // namespace dart |
| 108 | 110 |
| 109 | 111 |
| 110 #endif // VM_THREAD_H_ | 112 #endif // VM_OS_THREAD_H_ |
| OLD | NEW |