| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart 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 file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef BIN_EVENTHANDLER_LINUX_H_ | 5 #ifndef BIN_EVENTHANDLER_LINUX_H_ |
| 6 #define BIN_EVENTHANDLER_LINUX_H_ | 6 #define BIN_EVENTHANDLER_LINUX_H_ |
| 7 | 7 |
| 8 #if !defined(BIN_EVENTHANDLER_H_) | 8 #if !defined(BIN_EVENTHANDLER_H_) |
| 9 #error Do not include eventhandler_linux.h directly; use eventhandler.h instead. | 9 #error Do not include eventhandler_linux.h directly; use eventhandler.h instead. |
| 10 #endif | 10 #endif |
| 11 | 11 |
| 12 #include <unistd.h> | 12 #include <errno.h> |
| 13 #include <sys/epoll.h> | 13 #include <sys/epoll.h> |
| 14 #include <sys/socket.h> | 14 #include <sys/socket.h> |
| 15 #include <unistd.h> |
| 15 | 16 |
| 16 #include "platform/hashmap.h" | 17 #include "platform/hashmap.h" |
| 18 #include "platform/signal_blocker.h" |
| 17 | 19 |
| 18 | 20 |
| 19 namespace dart { | 21 namespace dart { |
| 20 namespace bin { | 22 namespace bin { |
| 21 | 23 |
| 22 class InterruptMessage { | 24 class InterruptMessage { |
| 23 public: | 25 public: |
| 24 intptr_t id; | 26 intptr_t id; |
| 25 Dart_Port dart_port; | 27 Dart_Port dart_port; |
| 26 int64_t data; | 28 int64_t data; |
| 27 }; | 29 }; |
| 28 | 30 |
| 29 | 31 |
| 30 class SocketData { | 32 class SocketData { |
| 31 public: | 33 public: |
| 32 explicit SocketData(intptr_t fd) : fd_(fd), port_(0), mask_(0), tokens_(8) { | 34 explicit SocketData(intptr_t fd) : fd_(fd), port_(0), mask_(0), tokens_(8) { |
| 33 ASSERT(fd_ != -1); | 35 ASSERT(fd_ != -1); |
| 34 } | 36 } |
| 35 | 37 |
| 36 intptr_t GetPollEvents(); | 38 intptr_t GetPollEvents(); |
| 37 | 39 |
| 38 void Close() { | 40 void Close() { |
| 39 port_ = 0; | 41 port_ = 0; |
| 40 mask_ = 0; | 42 mask_ = 0; |
| 41 close(fd_); | 43 VOID_TEMP_FAILURE_RETRY(close(fd_)); |
| 42 fd_ = -1; | 44 fd_ = -1; |
| 43 } | 45 } |
| 44 | 46 |
| 45 void SetPortAndMask(Dart_Port port, intptr_t mask) { | 47 void SetPortAndMask(Dart_Port port, intptr_t mask) { |
| 46 ASSERT(fd_ != -1); | 48 ASSERT(fd_ != -1); |
| 47 port_ = port; | 49 port_ = port; |
| 48 mask_ = mask; | 50 mask_ = mask; |
| 49 } | 51 } |
| 50 | 52 |
| 51 intptr_t fd() { return fd_; } | 53 intptr_t fd() { return fd_; } |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 bool shutdown_; | 102 bool shutdown_; |
| 101 int interrupt_fds_[2]; | 103 int interrupt_fds_[2]; |
| 102 int epoll_fd_; | 104 int epoll_fd_; |
| 103 int timer_fd_; | 105 int timer_fd_; |
| 104 }; | 106 }; |
| 105 | 107 |
| 106 } // namespace bin | 108 } // namespace bin |
| 107 } // namespace dart | 109 } // namespace dart |
| 108 | 110 |
| 109 #endif // BIN_EVENTHANDLER_LINUX_H_ | 111 #endif // BIN_EVENTHANDLER_LINUX_H_ |
| OLD | NEW |