added wait functionality
This commit is contained in:
parent
d1157e854a
commit
8ae794332b
|
@ -183,6 +183,8 @@ public:
|
|||
|
||||
void poll() override { pollImpl(0); }
|
||||
|
||||
void wait() override { pollImpl(-1); }
|
||||
|
||||
void subscribe(IFdOwner &owner, int fd, uint32_t event_mask) {
|
||||
if (epoll_fd < 0 || fd < 0) {
|
||||
return;
|
||||
|
|
|
@ -181,14 +181,43 @@ bool EventLoop::turn() {
|
|||
}
|
||||
|
||||
bool EventLoop::wait(const std::chrono::steady_clock::duration &duration) {
|
||||
return false;
|
||||
if (event_port) {
|
||||
event_port->wait();
|
||||
}
|
||||
|
||||
while (head) {
|
||||
if (!turn()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool EventLoop::wait(const std::chrono::steady_clock::time_point &time_point) {
|
||||
return false;
|
||||
if (event_port) {
|
||||
event_port->wait();
|
||||
}
|
||||
|
||||
while (head) {
|
||||
if (!turn()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool EventLoop::wait() { return false; }
|
||||
bool EventLoop::wait() {
|
||||
if (event_port) {
|
||||
event_port->wait();
|
||||
}
|
||||
|
||||
while (head) {
|
||||
if (!turn()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool EventLoop::poll() {
|
||||
if (event_port) {
|
||||
|
|
|
@ -173,6 +173,7 @@ public:
|
|||
virtual Conveyor<void> onSignal(Signal signal) = 0;
|
||||
|
||||
virtual void poll() = 0;
|
||||
virtual void wait() = 0;
|
||||
};
|
||||
|
||||
class SinkConveyorNode;
|
||||
|
|
Loading…
Reference in New Issue