Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(548)

Side by Side Diff: runtime/platform/thread.h

Issue 9141005: Change the thread interface in runtime/platform and use it starting all threads (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Removed Thread::Join as suggested by iposva@ Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 PLATFORM_THREAD_H_ 5 #ifndef PLATFORM_THREAD_H_
6 #define PLATFORM_THREAD_H_ 6 #define PLATFORM_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_LINUX) 11 #if defined(TARGET_OS_LINUX)
12 #include "platform/thread_linux.h" 12 #include "platform/thread_linux.h"
13 #elif defined(TARGET_OS_MACOS) 13 #elif defined(TARGET_OS_MACOS)
14 #include "platform/thread_macos.h" 14 #include "platform/thread_macos.h"
15 #elif defined(TARGET_OS_WINDOWS) 15 #elif defined(TARGET_OS_WINDOWS)
16 #include "platform/thread_win.h" 16 #include "platform/thread_win.h"
17 #else 17 #else
18 #error Unknown target os. 18 #error Unknown target os.
19 #endif 19 #endif
20 20
21 namespace dart { 21 namespace dart {
22 22
23 class Thread { 23 class Thread {
24 public: 24 public:
25 // Function to be called on thread start.
26 typedef void (*ThreadStartFunction) (uword parameter); 25 typedef void (*ThreadStartFunction) (uword parameter);
27 26
28 // TODO(iposva): Define the proper interface for spawning and killing threads. 27 // Start a thread running the specified function.
29 Thread(ThreadStartFunction function, uword parameters); 28 static void Start(ThreadStartFunction function, uword parameters);
siva 2012/01/24 02:26:05 Now that you are using threads formally in a threa
Søren Gjesse 2012/01/24 12:07:55 Added a return code here. It's an int which holds
30 ~Thread();
31
32 private:
33 ThreadData data_;
34
35 DISALLOW_COPY_AND_ASSIGN(Thread);
36 }; 29 };
37 30
38 31
39 class Mutex { 32 class Mutex {
40 public: 33 public:
41 Mutex(); 34 Mutex();
42 ~Mutex(); 35 ~Mutex();
43 36
44 void Lock(); 37 void Lock();
45 bool TryLock(); 38 bool TryLock();
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 private: 70 private:
78 MonitorData data_; // OS-specific data. 71 MonitorData data_; // OS-specific data.
79 72
80 DISALLOW_COPY_AND_ASSIGN(Monitor); 73 DISALLOW_COPY_AND_ASSIGN(Monitor);
81 }; 74 };
82 75
83 } // namespace dart 76 } // namespace dart
84 77
85 78
86 #endif // PLATFORM_THREAD_H_ 79 #endif // PLATFORM_THREAD_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698