| 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 #if defined(FLETCH_TARGET_OS_LK) | 5 #if defined(DARTINO_TARGET_OS_LK) |
| 6 | 6 |
| 7 #include "src/vm/event_handler.h" | 7 #include "src/vm/event_handler.h" |
| 8 | 8 |
| 9 #include <kernel/event.h> | 9 #include <kernel/event.h> |
| 10 #include <kernel/port.h> | 10 #include <kernel/port.h> |
| 11 | 11 |
| 12 #include "src/shared/utils.h" | 12 #include "src/shared/utils.h" |
| 13 #include "src/vm/object.h" | 13 #include "src/vm/object.h" |
| 14 #include "src/vm/port.h" | 14 #include "src/vm/port.h" |
| 15 #include "src/vm/process.h" | 15 #include "src/vm/process.h" |
| 16 #include "src/vm/scheduler.h" | 16 #include "src/vm/scheduler.h" |
| 17 #include "src/vm/thread.h" | 17 #include "src/vm/thread.h" |
| 18 | 18 |
| 19 namespace fletch { | 19 namespace dartino { |
| 20 | 20 |
| 21 const char* kFletchInterruptPortName = "FLETCH_INT"; | 21 const char* kDartinoInterruptPortName = "DARTINO_INT"; |
| 22 | 22 |
| 23 class PortSet { | 23 class PortSet { |
| 24 public: | 24 public: |
| 25 PortSet() : group(0), port_set(NULL) { | 25 PortSet() : group(0), port_set(NULL) { |
| 26 // Create and add the interrupt port. | 26 // Create and add the interrupt port. |
| 27 port_create(kFletchInterruptPortName, PORT_MODE_UNICAST, &interrupt_port); | 27 port_create(kDartinoInterruptPortName, PORT_MODE_UNICAST, &interrupt_port); |
| 28 port_t interrupt_read; | 28 port_t interrupt_read; |
| 29 port_open(kFletchInterruptPortName, NULL, &interrupt_read); | 29 port_open(kDartinoInterruptPortName, NULL, &interrupt_read); |
| 30 AddReadPort(interrupt_read); | 30 AddReadPort(interrupt_read); |
| 31 } | 31 } |
| 32 | 32 |
| 33 ~PortSet() { | 33 ~PortSet() { |
| 34 ASSERT(group != 0); | 34 ASSERT(group != 0); |
| 35 | 35 |
| 36 // Close the group | 36 // Close the group |
| 37 port_close(group); | 37 port_close(group); |
| 38 | 38 |
| 39 // Close all open read ports. | 39 // Close all open read ports. |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 | 155 |
| 156 if (has_result && result.ctx != NULL) { | 156 if (has_result && result.ctx != NULL) { |
| 157 int64 value = *reinterpret_cast<int64*>(&result.packet.value); | 157 int64 value = *reinterpret_cast<int64*>(&result.packet.value); |
| 158 Send(reinterpret_cast<Port*>(result.ctx), value, false); | 158 Send(reinterpret_cast<Port*>(result.ctx), value, false); |
| 159 } | 159 } |
| 160 | 160 |
| 161 HandleTimeouts(); | 161 HandleTimeouts(); |
| 162 } | 162 } |
| 163 } | 163 } |
| 164 | 164 |
| 165 } // namespace fletch | 165 } // namespace dartino |
| 166 | 166 |
| 167 #endif // defined(FLETCH_TARGET_OS_LK) | 167 #endif // defined(DARTINO_TARGET_OS_LK) |
| OLD | NEW |