| 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_LINUX) | 6 #if defined(TARGET_OS_LINUX) |
| 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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 void EventHandlerImplementation::WakeupHandler(intptr_t id, | 161 void EventHandlerImplementation::WakeupHandler(intptr_t id, |
| 162 Dart_Port dart_port, | 162 Dart_Port dart_port, |
| 163 int64_t data) { | 163 int64_t data) { |
| 164 InterruptMessage msg; | 164 InterruptMessage msg; |
| 165 msg.id = id; | 165 msg.id = id; |
| 166 msg.dart_port = dart_port; | 166 msg.dart_port = dart_port; |
| 167 msg.data = data; | 167 msg.data = data; |
| 168 // WriteToBlocking will write up to 512 bytes atomically, and since our msg | 168 // WriteToBlocking will write up to 512 bytes atomically, and since our msg |
| 169 // is smaller than 512, we don't need a thread lock. | 169 // is smaller than 512, we don't need a thread lock. |
| 170 // See: http://linux.die.net/man/7/pipe, section 'Pipe_buf'. | 170 // See: http://linux.die.net/man/7/pipe, section 'Pipe_buf'. |
| 171 ASSERT(kInterruptMessageSize < PIPE_BUF); |
| 171 intptr_t result = | 172 intptr_t result = |
| 172 FDUtils::WriteToBlocking(interrupt_fds_[1], &msg, kInterruptMessageSize); | 173 FDUtils::WriteToBlocking(interrupt_fds_[1], &msg, kInterruptMessageSize); |
| 173 if (result != kInterruptMessageSize) { | 174 if (result != kInterruptMessageSize) { |
| 174 if (result == -1) { | 175 if (result == -1) { |
| 175 perror("Interrupt message failure:"); | 176 perror("Interrupt message failure:"); |
| 176 } | 177 } |
| 177 FATAL1("Interrupt message failure. Wrote %" Pd " bytes.", result); | 178 FATAL1("Interrupt message failure. Wrote %" Pd " bytes.", result); |
| 178 } | 179 } |
| 179 } | 180 } |
| 180 | 181 |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 | 450 |
| 450 uint32_t EventHandlerImplementation::GetHashmapHashFromFd(intptr_t fd) { | 451 uint32_t EventHandlerImplementation::GetHashmapHashFromFd(intptr_t fd) { |
| 451 // The hashmap does not support keys with value 0. | 452 // The hashmap does not support keys with value 0. |
| 452 return dart::Utils::WordHash(fd + 1); | 453 return dart::Utils::WordHash(fd + 1); |
| 453 } | 454 } |
| 454 | 455 |
| 455 } // namespace bin | 456 } // namespace bin |
| 456 } // namespace dart | 457 } // namespace dart |
| 457 | 458 |
| 458 #endif // defined(TARGET_OS_LINUX) | 459 #endif // defined(TARGET_OS_LINUX) |
| OLD | NEW |