OLD | NEW |
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 #include "src/vm/port.h" | 5 #include "src/vm/port.h" |
6 | 6 |
7 #include <stdlib.h> | 7 #include <stdlib.h> |
8 | 8 |
9 #include "src/vm/interpreter.h" | 9 #include "src/vm/interpreter.h" |
10 #include "src/vm/natives.h" | 10 #include "src/vm/natives.h" |
11 #include "src/vm/object.h" | 11 #include "src/vm/object.h" |
12 #include "src/vm/process.h" | 12 #include "src/vm/process.h" |
13 | 13 |
14 namespace fletch { | 14 namespace dartino { |
15 | 15 |
16 Port::Port(Process* process, Instance* channel) | 16 Port::Port(Process* process, Instance* channel) |
17 : process_(process), | 17 : process_(process), |
18 channel_(channel), | 18 channel_(channel), |
19 ref_count_(1), | 19 ref_count_(1), |
20 spinlock_(), | 20 spinlock_(), |
21 next_(process->ports()) { | 21 next_(process->ports()) { |
22 ASSERT(process != NULL); | 22 ASSERT(process != NULL); |
23 #if defined(FLETCH_TARGET_OS_POSIX) | 23 #if defined(DARTINO_TARGET_OS_POSIX) |
24 ASSERT(Thread::GetProcess() == process); | 24 ASSERT(Thread::GetProcess() == process); |
25 #else | 25 #else |
26 // Other platforms do not have Thread Local Storage support and just return | 26 // Other platforms do not have Thread Local Storage support and just return |
27 // `NULL` here. | 27 // `NULL` here. |
28 #endif | 28 #endif |
29 process->set_ports(this); | 29 process->set_ports(this); |
30 } | 30 } |
31 | 31 |
32 Port::~Port() { ASSERT(ref_count_ == 0); } | 32 Port::~Port() { ASSERT(ref_count_ == 0); } |
33 | 33 |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 } | 180 } |
181 | 181 |
182 return TargetYieldResult(port, true).AsObject(); | 182 return TargetYieldResult(port, true).AsObject(); |
183 } | 183 } |
184 | 184 |
185 port->Unlock(); | 185 port->Unlock(); |
186 return Failure::illegal_state(); | 186 return Failure::illegal_state(); |
187 } | 187 } |
188 END_NATIVE() | 188 END_NATIVE() |
189 | 189 |
190 } // namespace fletch | 190 } // namespace dartino |
OLD | NEW |