OLD | NEW |
1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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_SHARED_PLATFORM_LK_H_ | 5 #ifndef SRC_SHARED_PLATFORM_LK_H_ |
6 #define SRC_SHARED_PLATFORM_LK_H_ | 6 #define SRC_SHARED_PLATFORM_LK_H_ |
7 | 7 |
8 #ifndef SRC_SHARED_PLATFORM_H_ | 8 #ifndef SRC_SHARED_PLATFORM_H_ |
9 #error Do not include platform_lk.h directly; use platform.h instead. | 9 #error Do not include platform_lk.h directly; use platform.h instead. |
10 #endif | 10 #endif |
11 | 11 |
12 #if defined(FLETCH_TARGET_OS_LK) | 12 #if defined(DARTINO_TARGET_OS_LK) |
13 | 13 |
14 #include <err.h> | 14 #include <err.h> |
15 #include <kernel/thread.h> | 15 #include <kernel/thread.h> |
16 #include <kernel/semaphore.h> | 16 #include <kernel/semaphore.h> |
17 | 17 |
18 #include "src/shared/globals.h" | 18 #include "src/shared/globals.h" |
19 | 19 |
20 #define CHECK_AND_RETURN(expr) \ | 20 #define CHECK_AND_RETURN(expr) \ |
21 { \ | 21 { \ |
22 int status = expr; \ | 22 int status = expr; \ |
23 if (status != NO_ERROR) return status; \ | 23 if (status != NO_ERROR) return status; \ |
24 } | 24 } |
25 #define CHECK_AND_FAIL(expr) \ | 25 #define CHECK_AND_FAIL(expr) \ |
26 { \ | 26 { \ |
27 int status = expr; \ | 27 int status = expr; \ |
28 if (status != NO_ERROR) { \ | 28 if (status != NO_ERROR) { \ |
29 FATAL("System call failed.\n"); \ | 29 FATAL("System call failed.\n"); \ |
30 } \ | 30 } \ |
31 } | 31 } |
32 | 32 |
33 namespace fletch { | 33 namespace dartino { |
34 | 34 |
35 // Forward declare [Platform::GetMicroseconds]. | 35 // Forward declare [Platform::GetMicroseconds]. |
36 namespace Platform { | 36 namespace Platform { |
37 uint64 GetMicroseconds(); | 37 uint64 GetMicroseconds(); |
38 } // namespace Platform | 38 } // namespace Platform |
39 | 39 |
40 class MutexImpl { | 40 class MutexImpl { |
41 public: | 41 public: |
42 MutexImpl() { mutex_init(&mutex_); } | 42 MutexImpl() { mutex_init(&mutex_); } |
43 ~MutexImpl() { mutex_destroy(&mutex_); } | 43 ~MutexImpl() { mutex_destroy(&mutex_); } |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 return true; | 180 return true; |
181 } | 181 } |
182 | 182 |
183 mutex_t mutex_; | 183 mutex_t mutex_; |
184 mutex_t internal_; | 184 mutex_t internal_; |
185 | 185 |
186 WaitListEntry* first_waiting_; | 186 WaitListEntry* first_waiting_; |
187 WaitListEntry* last_waiting_; | 187 WaitListEntry* last_waiting_; |
188 }; | 188 }; |
189 | 189 |
190 } // namespace fletch | 190 } // namespace dartino |
191 | 191 |
192 #endif // defined(FLETCH_TARGET_OS_LK) | 192 #endif // defined(DARTINO_TARGET_OS_LK) |
193 | 193 |
194 #endif // SRC_SHARED_PLATFORM_LK_H_ | 194 #endif // SRC_SHARED_PLATFORM_LK_H_ |
OLD | NEW |