Index: runtime/bin/process.h |
diff --git a/runtime/bin/process.h b/runtime/bin/process.h |
index 02a9ecc845372bf46fa04c0ce5cb2f2c32e5d4a1..4709770304e1c1b012b50c4a328760f966b6368f 100644 |
--- a/runtime/bin/process.h |
+++ b/runtime/bin/process.h |
@@ -84,6 +84,9 @@ class Process { |
static intptr_t CurrentProcessId(); |
+ static intptr_t SetSignalHandler(intptr_t signal); |
+ static void ClearSignalHandler(intptr_t signal); |
+ |
static Dart_Handle GetProcessIdNativeField(Dart_Handle process, |
intptr_t* pid); |
static Dart_Handle SetProcessIdNativeField(Dart_Handle process, |
@@ -98,6 +101,46 @@ class Process { |
}; |
+class SignalInfo { |
+ public: |
+ SignalInfo(int fd, int signal, SignalInfo* prev = NULL) |
+ : fd_(fd), |
+ signal_(signal), |
+ // SignalInfo is expected to be created when in a isolate. |
+ port_(Dart_GetMainPortId()), |
+ next_(NULL), |
+ prev_(prev) { |
+ if (prev_ != NULL) { |
+ prev_->next_ = this; |
+ } |
+ } |
+ |
+ ~SignalInfo(); |
+ |
+ void Unlink() { |
+ if (prev_ != NULL) { |
+ prev_->next_ = next_; |
+ } |
+ if (next_ != NULL) { |
+ next_->prev_ = prev_; |
+ } |
+ } |
+ |
+ int fd() const { return fd_; } |
+ int signal() const { return signal_; } |
+ Dart_Port port() const { return port_; } |
+ SignalInfo* next() const { return next_; } |
+ |
+ private: |
+ int fd_; |
+ int signal_; |
+ // The port_ is used to identify what isolate the signal-info belongs to. |
+ Dart_Port port_; |
+ SignalInfo* next_; |
+ SignalInfo* prev_; |
+}; |
+ |
+ |
// Utility class for collecting the output when running a process |
// synchronously by using Process::Wait. This class is sub-classed in |
// the platform specific files to implement reading into the buffers |