5#include "flutter/fml/platform/linux/message_loop_linux.h"
10#include "flutter/fml/eintr_wrapper.h"
11#include "flutter/fml/platform/linux/timerfd.h"
17MessageLoopLinux::MessageLoopLinux()
22 bool added_source = AddOrRemoveTimerSource(
true);
26MessageLoopLinux::~MessageLoopLinux() {
27 bool removed_source = AddOrRemoveTimerSource(
false);
31bool MessageLoopLinux::AddOrRemoveTimerSource(
bool add) {
32 struct epoll_event
event = {};
34 event.events = EPOLLIN;
37 event.data.fd = timer_fd_.get();
40 ::epoll_ctl(epoll_fd_.get(), add ? EPOLL_CTL_ADD : EPOLL_CTL_DEL,
41 timer_fd_.get(), &
event);
42 return ctl_result == 0;
50 struct epoll_event
event = {};
53 ::epoll_wait(epoll_fd_.get(), &
event, 1, -1 ));
56 if (
event.events & (EPOLLERR | EPOLLHUP)) {
63 if (epoll_result != 1) {
68 if (
event.data.fd == timer_fd_.get()) {
75void MessageLoopLinux::Terminate() {
87void MessageLoopLinux::OnEventFired() {
#define FML_HANDLE_EINTR(x)
#define FML_CHECK(condition)
#define FML_DCHECK(condition)
static constexpr int kClockType
bool TimerRearm(int fd, fml::TimePoint time_point)
Rearms the timer to expire at the given time point.
int timerfd_create(int clockid, int flags)