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_OS_THREAD_H_ | 5 #ifndef VM_OS_THREAD_H_ |
6 #define VM_OS_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 #include "vm/allocation.h" |
10 | 10 |
(...skipping 12 matching lines...) Expand all Loading... |
23 | 23 |
24 namespace dart { | 24 namespace dart { |
25 | 25 |
26 // Low-level operations on OS platform threads. | 26 // Low-level operations on OS platform threads. |
27 class OSThread : AllStatic { | 27 class OSThread : AllStatic { |
28 public: | 28 public: |
29 static ThreadLocalKey kUnsetThreadLocalKey; | 29 static ThreadLocalKey kUnsetThreadLocalKey; |
30 static ThreadId kInvalidThreadId; | 30 static ThreadId kInvalidThreadId; |
31 | 31 |
32 typedef void (*ThreadStartFunction) (uword parameter); | 32 typedef void (*ThreadStartFunction) (uword parameter); |
| 33 typedef void (*ThreadDestructor) (void* parameter); |
33 | 34 |
34 // Start a thread running the specified function. Returns 0 if the | 35 // Start a thread running the specified function. Returns 0 if the |
35 // thread started successfuly and a system specific error code if | 36 // thread started successfuly and a system specific error code if |
36 // the thread failed to start. | 37 // the thread failed to start. |
37 static int Start(ThreadStartFunction function, uword parameters); | 38 static int Start(ThreadStartFunction function, uword parameters); |
38 | 39 |
39 static ThreadLocalKey CreateThreadLocal(); | 40 // NOTE: Destructor currently ignored on Windows (issue 23474). |
| 41 static ThreadLocalKey CreateThreadLocal(ThreadDestructor destructor = NULL); |
40 static void DeleteThreadLocal(ThreadLocalKey key); | 42 static void DeleteThreadLocal(ThreadLocalKey key); |
41 static uword GetThreadLocal(ThreadLocalKey key) { | 43 static uword GetThreadLocal(ThreadLocalKey key) { |
42 return ThreadInlineImpl::GetThreadLocal(key); | 44 return ThreadInlineImpl::GetThreadLocal(key); |
43 } | 45 } |
44 static void SetThreadLocal(ThreadLocalKey key, uword value); | 46 static void SetThreadLocal(ThreadLocalKey key, uword value); |
45 static intptr_t GetMaxStackSize(); | 47 static intptr_t GetMaxStackSize(); |
46 static ThreadId GetCurrentThreadId(); | 48 static ThreadId GetCurrentThreadId(); |
47 static bool Join(ThreadId id); | 49 static bool Join(ThreadId id); |
48 static intptr_t ThreadIdToIntPtr(ThreadId id); | 50 static intptr_t ThreadIdToIntPtr(ThreadId id); |
49 static bool Compare(ThreadId a, ThreadId b); | 51 static bool Compare(ThreadId a, ThreadId b); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 MonitorData data_; // OS-specific data. | 105 MonitorData data_; // OS-specific data. |
104 | 106 |
105 DISALLOW_COPY_AND_ASSIGN(Monitor); | 107 DISALLOW_COPY_AND_ASSIGN(Monitor); |
106 }; | 108 }; |
107 | 109 |
108 | 110 |
109 } // namespace dart | 111 } // namespace dart |
110 | 112 |
111 | 113 |
112 #endif // VM_OS_THREAD_H_ | 114 #endif // VM_OS_THREAD_H_ |
OLD | NEW |