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 |
(...skipping 25 matching lines...) Expand all Loading... |
36 port_(0), | 36 port_(0), |
37 mask_(0), | 37 mask_(0), |
38 tracked_by_kqueue_(false), | 38 tracked_by_kqueue_(false), |
39 tokens_(16) { | 39 tokens_(16) { |
40 ASSERT(fd_ != -1); | 40 ASSERT(fd_ != -1); |
41 } | 41 } |
42 | 42 |
43 bool HasReadEvent(); | 43 bool HasReadEvent(); |
44 bool HasWriteEvent(); | 44 bool HasWriteEvent(); |
45 | 45 |
46 void Close() { | |
47 port_ = 0; | |
48 mask_ = 0; | |
49 VOID_TEMP_FAILURE_RETRY(close(fd_)); | |
50 fd_ = -1; | |
51 } | |
52 | |
53 bool IsListeningSocket() { return (mask_ & (1 << kListeningSocket)) != 0; } | 46 bool IsListeningSocket() { return (mask_ & (1 << kListeningSocket)) != 0; } |
54 | 47 |
55 void SetPortAndMask(Dart_Port port, intptr_t mask) { | 48 void SetPortAndMask(Dart_Port port, intptr_t mask) { |
56 ASSERT(fd_ != -1); | 49 ASSERT(fd_ != -1); |
57 port_ = port; | 50 port_ = port; |
58 mask_ = mask; | 51 mask_ = mask; |
59 } | 52 } |
60 | 53 |
61 intptr_t fd() { return fd_; } | 54 intptr_t fd() { return fd_; } |
62 Dart_Port port() { return port_; } | 55 Dart_Port port() { return port_; } |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 TimeoutQueue timeout_queue_; | 108 TimeoutQueue timeout_queue_; |
116 bool shutdown_; | 109 bool shutdown_; |
117 int interrupt_fds_[2]; | 110 int interrupt_fds_[2]; |
118 int kqueue_fd_; | 111 int kqueue_fd_; |
119 }; | 112 }; |
120 | 113 |
121 } // namespace bin | 114 } // namespace bin |
122 } // namespace dart | 115 } // namespace dart |
123 | 116 |
124 #endif // BIN_EVENTHANDLER_MACOS_H_ | 117 #endif // BIN_EVENTHANDLER_MACOS_H_ |
OLD | NEW |