| 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 #include "platform/globals.h" | 5 #include "platform/globals.h" |
| 6 #if defined(TARGET_OS_MACOS) | 6 #if defined(TARGET_OS_MACOS) |
| 7 | 7 |
| 8 #include "bin/eventhandler.h" | 8 #include "bin/eventhandler.h" |
| 9 | 9 |
| 10 #include <errno.h> // NOLINT | 10 #include <errno.h> // NOLINT |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 | 179 |
| 180 void EventHandlerImplementation::WakeupHandler(intptr_t id, | 180 void EventHandlerImplementation::WakeupHandler(intptr_t id, |
| 181 Dart_Port dart_port, | 181 Dart_Port dart_port, |
| 182 int64_t data) { | 182 int64_t data) { |
| 183 InterruptMessage msg; | 183 InterruptMessage msg; |
| 184 msg.id = id; | 184 msg.id = id; |
| 185 msg.dart_port = dart_port; | 185 msg.dart_port = dart_port; |
| 186 msg.data = data; | 186 msg.data = data; |
| 187 // WriteToBlocking will write up to 512 bytes atomically, and since our msg | 187 // WriteToBlocking will write up to 512 bytes atomically, and since our msg |
| 188 // is smaller than 512, we don't need a thread lock. | 188 // is smaller than 512, we don't need a thread lock. |
| 189 // See: http://linux.die.net/man/7/pipe, section 'Pipe_buf'. | 189 ASSERT(kInterruptMessageSize < PIPE_BUF); |
| 190 intptr_t result = | 190 intptr_t result = |
| 191 FDUtils::WriteToBlocking(interrupt_fds_[1], &msg, kInterruptMessageSize); | 191 FDUtils::WriteToBlocking(interrupt_fds_[1], &msg, kInterruptMessageSize); |
| 192 if (result != kInterruptMessageSize) { | 192 if (result != kInterruptMessageSize) { |
| 193 if (result == -1) { | 193 if (result == -1) { |
| 194 perror("Interrupt message failure:"); | 194 perror("Interrupt message failure:"); |
| 195 } | 195 } |
| 196 FATAL1("Interrupt message failure. Wrote %" Pd " bytes.", result); | 196 FATAL1("Interrupt message failure. Wrote %" Pd " bytes.", result); |
| 197 } | 197 } |
| 198 } | 198 } |
| 199 | 199 |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 | 460 |
| 461 uint32_t EventHandlerImplementation::GetHashmapHashFromFd(intptr_t fd) { | 461 uint32_t EventHandlerImplementation::GetHashmapHashFromFd(intptr_t fd) { |
| 462 // The hashmap does not support keys with value 0. | 462 // The hashmap does not support keys with value 0. |
| 463 return dart::Utils::WordHash(fd + 1); | 463 return dart::Utils::WordHash(fd + 1); |
| 464 } | 464 } |
| 465 | 465 |
| 466 } // namespace bin | 466 } // namespace bin |
| 467 } // namespace dart | 467 } // namespace dart |
| 468 | 468 |
| 469 #endif // defined(TARGET_OS_MACOS) | 469 #endif // defined(TARGET_OS_MACOS) |
| OLD | NEW |