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

Side by Side Diff: src/vm/thread_cmsis.h

Issue 1659163007: Rename fletch -> dartino (Closed) Base URL: https://github.com/dartino/sdk.git@master
Patch Set: address comments Created 4 years, 10 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
« no previous file with comments | « src/vm/thread.h ('k') | src/vm/thread_cmsis.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef SRC_VM_THREAD_CMSIS_H_ 5 #ifndef SRC_VM_THREAD_CMSIS_H_
6 #define SRC_VM_THREAD_CMSIS_H_ 6 #define SRC_VM_THREAD_CMSIS_H_
7 7
8 #ifndef SRC_VM_THREAD_H_ 8 #ifndef SRC_VM_THREAD_H_
9 #error "Don't include thread_cmsis.h directly, include thread.h." 9 #error "Don't include thread_cmsis.h directly, include thread.h."
10 #endif 10 #endif
11 11
12 #include <cmsis_os.h> 12 #include <cmsis_os.h>
13 #include <errno.h> 13 #include <errno.h>
14 14
15 #include "src/shared/assert.h" 15 #include "src/shared/assert.h"
16 16
17 namespace fletch { 17 namespace dartino {
18 18
19 // A ThreadIdentifier represents a thread identifier for a thread. 19 // A ThreadIdentifier represents a thread identifier for a thread.
20 // The ThreadIdentifier does not own the underlying OS handle. 20 // The ThreadIdentifier does not own the underlying OS handle.
21 // Thread handles can be used for referring to threads and testing equality. 21 // Thread handles can be used for referring to threads and testing equality.
22 class ThreadIdentifier { 22 class ThreadIdentifier {
23 public: 23 public:
24 ThreadIdentifier() : thread_(osThreadGetId()) {} 24 ThreadIdentifier() : thread_(osThreadGetId()) {}
25 25
26 // Test for thread running. 26 // Test for thread running.
27 bool IsSelf() const { return osThreadGetId() == thread_; } 27 bool IsSelf() const { return osThreadGetId() == thread_; }
28 28
29 // Try to join the thread identified by this [ThreadIdentifier]. 29 // Try to join the thread identified by this [ThreadIdentifier].
30 // 30 //
31 // A thread can only be joined once. 31 // A thread can only be joined once.
32 void Join() { 32 void Join() {
33 printf("ThreadIdentifier::Join is not supported on CMSIS.\n"); 33 printf("ThreadIdentifier::Join is not supported on CMSIS.\n");
34 fflush(stdout); 34 fflush(stdout);
35 } 35 }
36 36
37 private: 37 private:
38 friend class Thread; 38 friend class Thread;
39 39
40 explicit ThreadIdentifier(osThreadId thread) : thread_(thread) {} 40 explicit ThreadIdentifier(osThreadId thread) : thread_(thread) {}
41 41
42 osThreadId thread_; 42 osThreadId thread_;
43 }; 43 };
44 44
45 } // namespace fletch 45 } // namespace dartino
46 46
47 #endif // SRC_VM_THREAD_CMSIS_H_ 47 #endif // SRC_VM_THREAD_CMSIS_H_
OLDNEW
« no previous file with comments | « src/vm/thread.h ('k') | src/vm/thread_cmsis.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698