| 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_VM_SIGNAL_H_ | 5 #ifndef SRC_VM_SIGNAL_H_ |
| 6 #define SRC_VM_SIGNAL_H_ | 6 #define SRC_VM_SIGNAL_H_ |
| 7 | 7 |
| 8 #include "src/shared/globals.h" | 8 #include "src/shared/globals.h" |
| 9 #include "src/shared/atomic.h" | 9 #include "src/shared/atomic.h" |
| 10 | 10 |
| 11 #include "src/vm/heap.h" | 11 #include "src/vm/heap.h" |
| 12 #include "src/vm/refcounted.h" | 12 #include "src/vm/refcounted.h" |
| 13 #include "src/vm/port.h" | 13 #include "src/vm/port.h" |
| 14 #include "src/vm/process_handle.h" | 14 #include "src/vm/process_handle.h" |
| 15 | 15 |
| 16 namespace fletch { | 16 namespace dartino { |
| 17 | 17 |
| 18 class Signal : public Refcounted<Signal> { | 18 class Signal : public Refcounted<Signal> { |
| 19 public: | 19 public: |
| 20 // Please keep these in sync with lib/fletch/fletch.dart:SignalKind. | 20 // Please keep these in sync with lib/dartino/dartino.dart:SignalKind. |
| 21 enum Kind { | 21 enum Kind { |
| 22 kCompileTimeError, | 22 kCompileTimeError, |
| 23 kTerminated, | 23 kTerminated, |
| 24 kUncaughtException, | 24 kUncaughtException, |
| 25 kUnhandledSignal, | 25 kUnhandledSignal, |
| 26 kKilled, | 26 kKilled, |
| 27 | 27 |
| 28 // Dummy entry used for communicating to the scheduler that | 28 // Dummy entry used for communicating to the scheduler that |
| 29 // that a process should be killed. | 29 // that a process should be killed. |
| 30 kShouldKill, | 30 kShouldKill, |
| 31 }; | 31 }; |
| 32 | 32 |
| 33 Signal(ProcessHandle* handle, Kind kind) | 33 Signal(ProcessHandle* handle, Kind kind) |
| 34 : process_handle_(handle), kind_(kind) { | 34 : process_handle_(handle), kind_(kind) { |
| 35 process_handle_->IncrementRef(); | 35 process_handle_->IncrementRef(); |
| 36 } | 36 } |
| 37 | 37 |
| 38 ~Signal() { ProcessHandle::DecrementRef(process_handle_); } | 38 ~Signal() { ProcessHandle::DecrementRef(process_handle_); } |
| 39 | 39 |
| 40 ProcessHandle* handle() const { return process_handle_; } | 40 ProcessHandle* handle() const { return process_handle_; } |
| 41 Kind kind() const { return kind_; } | 41 Kind kind() const { return kind_; } |
| 42 | 42 |
| 43 private: | 43 private: |
| 44 ProcessHandle* const process_handle_; | 44 ProcessHandle* const process_handle_; |
| 45 const Kind kind_; | 45 const Kind kind_; |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 } // namespace fletch | 48 } // namespace dartino |
| 49 | 49 |
| 50 #endif // SRC_VM_SIGNAL_H_ | 50 #endif // SRC_VM_SIGNAL_H_ |
| OLD | NEW |