| 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_MACOS_H_ | 5 #ifndef BIN_EVENTHANDLER_MACOS_H_ |
| 6 #define BIN_EVENTHANDLER_MACOS_H_ | 6 #define BIN_EVENTHANDLER_MACOS_H_ |
| 7 | 7 |
| 8 #if !defined(BIN_EVENTHANDLER_H_) | 8 #if !defined(BIN_EVENTHANDLER_H_) |
| 9 #error Do not include eventhandler_macos.h directly; use eventhandler.h instead. | 9 #error Do not include eventhandler_macos.h directly; use eventhandler.h instead. |
| 10 #endif | 10 #endif |
| 11 | 11 |
| 12 #include <unistd.h> | 12 #include <errno.h> |
| 13 #include <sys/event.h> // NOLINT | 13 #include <sys/event.h> // NOLINT |
| 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; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 37 tokens_(8) { | 39 tokens_(8) { |
| 38 ASSERT(fd_ != -1); | 40 ASSERT(fd_ != -1); |
| 39 } | 41 } |
| 40 | 42 |
| 41 bool HasReadEvent(); | 43 bool HasReadEvent(); |
| 42 bool HasWriteEvent(); | 44 bool HasWriteEvent(); |
| 43 | 45 |
| 44 void Close() { | 46 void Close() { |
| 45 port_ = 0; | 47 port_ = 0; |
| 46 mask_ = 0; | 48 mask_ = 0; |
| 47 close(fd_); | 49 VOID_TEMP_FAILURE_RETRY(close(fd_)); |
| 48 fd_ = -1; | 50 fd_ = -1; |
| 49 } | 51 } |
| 50 | 52 |
| 51 bool IsListeningSocket() { return (mask_ & (1 << kListeningSocket)) != 0; } | 53 bool IsListeningSocket() { return (mask_ & (1 << kListeningSocket)) != 0; } |
| 52 | 54 |
| 53 void SetPortAndMask(Dart_Port port, intptr_t mask) { | 55 void SetPortAndMask(Dart_Port port, intptr_t mask) { |
| 54 ASSERT(fd_ != -1); | 56 ASSERT(fd_ != -1); |
| 55 port_ = port; | 57 port_ = port; |
| 56 mask_ = mask; | 58 mask_ = mask; |
| 57 } | 59 } |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 TimeoutQueue timeout_queue_; | 115 TimeoutQueue timeout_queue_; |
| 114 bool shutdown_; | 116 bool shutdown_; |
| 115 int interrupt_fds_[2]; | 117 int interrupt_fds_[2]; |
| 116 int kqueue_fd_; | 118 int kqueue_fd_; |
| 117 }; | 119 }; |
| 118 | 120 |
| 119 } // namespace bin | 121 } // namespace bin |
| 120 } // namespace dart | 122 } // namespace dart |
| 121 | 123 |
| 122 #endif // BIN_EVENTHANDLER_MACOS_H_ | 124 #endif // BIN_EVENTHANDLER_MACOS_H_ |
| OLD | NEW |