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 BIN_THREAD_H_ | 5 #ifndef BIN_THREAD_H_ |
6 #define BIN_THREAD_H_ | 6 #define BIN_THREAD_H_ |
7 | 7 |
8 #include "platform/globals.h" | 8 #include "platform/globals.h" |
9 | 9 |
10 // Declare the OS-specific types ahead of defining the generic classes. | 10 // Declare the OS-specific types ahead of defining the generic classes. |
11 #if defined(TARGET_OS_ANDROID) | 11 #if defined(TARGET_OS_ANDROID) |
12 #include "bin/thread_android.h" | 12 #include "bin/thread_android.h" |
13 #elif defined(TARGET_OS_LINUX) | 13 #elif defined(TARGET_OS_LINUX) |
14 #include "bin/thread_linux.h" | 14 #include "bin/thread_linux.h" |
15 #elif defined(TARGET_OS_MACOS) | 15 #elif defined(TARGET_OS_MACOS) |
16 #include "bin/thread_macos.h" | 16 #include "bin/thread_macos.h" |
17 #elif defined(TARGET_OS_WINDOWS) | 17 #elif defined(TARGET_OS_WINDOWS) |
18 #include "bin/thread_win.h" | 18 #include "bin/thread_win.h" |
19 #else | 19 #else |
20 #error Unknown target os. | 20 #error Unknown target os. |
21 #endif | 21 #endif |
22 | 22 |
23 namespace dart { | 23 namespace dart { |
| 24 namespace bin { |
24 | 25 |
25 class Thread { | 26 class Thread { |
26 public: | 27 public: |
27 static ThreadLocalKey kUnsetThreadLocalKey; | 28 static ThreadLocalKey kUnsetThreadLocalKey; |
28 static ThreadId kInvalidThreadId; | 29 static ThreadId kInvalidThreadId; |
29 | 30 |
30 typedef void (*ThreadStartFunction) (uword parameter); | 31 typedef void (*ThreadStartFunction) (uword parameter); |
31 | 32 |
32 // Start a thread running the specified function. Returns 0 if the | 33 // Start a thread running the specified function. Returns 0 if the |
33 // thread started successfuly and a system specific error code if | 34 // thread started successfuly and a system specific error code if |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 void Notify(); | 89 void Notify(); |
89 void NotifyAll(); | 90 void NotifyAll(); |
90 | 91 |
91 private: | 92 private: |
92 MonitorData data_; // OS-specific data. | 93 MonitorData data_; // OS-specific data. |
93 | 94 |
94 DISALLOW_COPY_AND_ASSIGN(Monitor); | 95 DISALLOW_COPY_AND_ASSIGN(Monitor); |
95 }; | 96 }; |
96 | 97 |
97 | 98 |
| 99 } // namespace bin |
98 } // namespace dart | 100 } // namespace dart |
99 | 101 |
100 | 102 |
101 #endif // BIN_THREAD_H_ | 103 #endif // BIN_THREAD_H_ |
OLD | NEW |