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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 intptr_t fd() { return fd_; } | 54 intptr_t fd() { return fd_; } |
55 Dart_Port port() { return port_; } | 55 Dart_Port port() { return port_; } |
56 intptr_t mask() { return mask_; } | 56 intptr_t mask() { return mask_; } |
57 bool tracked_by_kqueue() { return tracked_by_kqueue_; } | 57 bool tracked_by_kqueue() { return tracked_by_kqueue_; } |
58 void set_tracked_by_kqueue(bool value) { | 58 void set_tracked_by_kqueue(bool value) { |
59 tracked_by_kqueue_ = value; | 59 tracked_by_kqueue_ = value; |
60 } | 60 } |
61 | 61 |
62 // Returns true if the last token was taken. | 62 // Returns true if the last token was taken. |
63 bool TakeToken() { | 63 bool TakeToken() { |
| 64 ASSERT(tokens_ > 0); |
64 tokens_--; | 65 tokens_--; |
65 return tokens_ == 0; | 66 return tokens_ == 0; |
66 } | 67 } |
67 | 68 |
68 // Returns true if the tokens was 0 before adding. | 69 // Returns true if the tokens was 0 before adding. |
69 bool ReturnToken() { | 70 bool ReturnToken() { |
70 tokens_++; | 71 tokens_++; |
71 return tokens_ == 1; | 72 return tokens_ == 1; |
72 } | 73 } |
73 | 74 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 TimeoutQueue timeout_queue_; | 109 TimeoutQueue timeout_queue_; |
109 bool shutdown_; | 110 bool shutdown_; |
110 int interrupt_fds_[2]; | 111 int interrupt_fds_[2]; |
111 int kqueue_fd_; | 112 int kqueue_fd_; |
112 }; | 113 }; |
113 | 114 |
114 } // namespace bin | 115 } // namespace bin |
115 } // namespace dart | 116 } // namespace dart |
116 | 117 |
117 #endif // BIN_EVENTHANDLER_MACOS_H_ | 118 #endif // BIN_EVENTHANDLER_MACOS_H_ |
OLD | NEW |