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 #include "bin/eventhandler_linux.h" | 9 #include "bin/eventhandler_linux.h" |
10 | 10 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 struct epoll_event event; | 102 struct epoll_event event; |
103 event.events = EPOLLIN; | 103 event.events = EPOLLIN; |
104 event.data.ptr = NULL; | 104 event.data.ptr = NULL; |
105 int status = NO_RETRY_EXPECTED(epoll_ctl(epoll_fd_, | 105 int status = NO_RETRY_EXPECTED(epoll_ctl(epoll_fd_, |
106 EPOLL_CTL_ADD, | 106 EPOLL_CTL_ADD, |
107 interrupt_fds_[0], | 107 interrupt_fds_[0], |
108 &event)); | 108 &event)); |
109 if (status == -1) { | 109 if (status == -1) { |
110 FATAL("Failed adding interrupt fd to epoll instance"); | 110 FATAL("Failed adding interrupt fd to epoll instance"); |
111 } | 111 } |
112 timer_fd_ = NO_RETRY_EXPECTED(timerfd_create(CLOCK_REALTIME, TFD_CLOEXEC)); | 112 timer_fd_ = NO_RETRY_EXPECTED(timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC)); |
113 if (timer_fd_ == -1) { | 113 if (timer_fd_ == -1) { |
114 FATAL1("Failed creating timerfd file descriptor: %i", errno); | 114 FATAL1("Failed creating timerfd file descriptor: %i", errno); |
115 } | 115 } |
116 // Register the timer_fd_ with the epoll instance. | 116 // Register the timer_fd_ with the epoll instance. |
117 event.events = EPOLLIN; | 117 event.events = EPOLLIN; |
118 event.data.fd = timer_fd_; | 118 event.data.fd = timer_fd_; |
119 status = NO_RETRY_EXPECTED(epoll_ctl(epoll_fd_, | 119 status = NO_RETRY_EXPECTED(epoll_ctl(epoll_fd_, |
120 EPOLL_CTL_ADD, | 120 EPOLL_CTL_ADD, |
121 timer_fd_, | 121 timer_fd_, |
122 &event)); | 122 &event)); |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 | 413 |
414 uint32_t EventHandlerImplementation::GetHashmapHashFromFd(intptr_t fd) { | 414 uint32_t EventHandlerImplementation::GetHashmapHashFromFd(intptr_t fd) { |
415 // The hashmap does not support keys with value 0. | 415 // The hashmap does not support keys with value 0. |
416 return dart::Utils::WordHash(fd + 1); | 416 return dart::Utils::WordHash(fd + 1); |
417 } | 417 } |
418 | 418 |
419 } // namespace bin | 419 } // namespace bin |
420 } // namespace dart | 420 } // namespace dart |
421 | 421 |
422 #endif // defined(TARGET_OS_LINUX) | 422 #endif // defined(TARGET_OS_LINUX) |
OLD | NEW |