mirror of
https://github.com/adamdruppe/arsd.git
synced 2025-04-26 13:20:05 +03:00
changes for terminal emulator
This commit is contained in:
parent
dbc6110d57
commit
7d16a8c8aa
3 changed files with 109 additions and 22 deletions
19
eventloop.d
19
eventloop.d
|
@ -474,8 +474,25 @@ version(linux) {
|
|||
|
||||
auto nfds = epoll_wait(epoll, events.ptr, events.length, lowestWait);
|
||||
moreEvents:
|
||||
if(nfds == -1)
|
||||
if(nfds == -1) {
|
||||
if(errno == EINTR) {
|
||||
// if we're interrupted, we can just advance the timers (we know none triggered since the timeout didn't go off) and try again
|
||||
if(timers.length) {
|
||||
long prev = tv.tv_sec * 1000 + tv.tv_usec / 1000;
|
||||
gettimeofday(&tv, null);
|
||||
long diff = tv.tv_sec * 1000 + tv.tv_usec / 1000 - prev;
|
||||
|
||||
for(size_t idx = 0; idx < timers.length; idx++) {
|
||||
auto timer = timers[idx];
|
||||
timer.timeoutRemaining -= diff;
|
||||
}
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
throw new Exception("epoll_wait");
|
||||
}
|
||||
|
||||
foreach(n; 0 .. nfds) {
|
||||
auto fd = events[n].data.fd;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue