mirror of https://github.com/adamdruppe/arsd.git
x event delay on fast timer on linux
This commit is contained in:
parent
402ea062b8
commit
d958638298
|
@ -11,6 +11,7 @@
|
||||||
Event Loop would be nices:
|
Event Loop would be nices:
|
||||||
|
|
||||||
* add on idle - runs when nothing else happens
|
* add on idle - runs when nothing else happens
|
||||||
|
* which can specify how long to yield for
|
||||||
* send messages without a recipient window
|
* send messages without a recipient window
|
||||||
* setTimeout
|
* setTimeout
|
||||||
* setInterval
|
* setInterval
|
||||||
|
@ -3188,6 +3189,7 @@ struct EventLoopImpl {
|
||||||
auto nfds = ep.epoll_wait(epollFd, events.ptr, events.length, (wto == 0 || wto >= int.max ? -1 : cast(int)wto));
|
auto nfds = ep.epoll_wait(epollFd, events.ptr, events.length, (wto == 0 || wto >= int.max ? -1 : cast(int)wto));
|
||||||
if(nfds == -1) {
|
if(nfds == -1) {
|
||||||
if(err.errno == err.EINTR) {
|
if(err.errno == err.EINTR) {
|
||||||
|
//if(forceXPending) goto xpending;
|
||||||
continue; // interrupted by signal, just try again
|
continue; // interrupted by signal, just try again
|
||||||
}
|
}
|
||||||
throw new Exception("epoll wait failure");
|
throw new Exception("epoll wait failure");
|
||||||
|
@ -3237,6 +3239,7 @@ struct EventLoopImpl {
|
||||||
//
|
//
|
||||||
// IOW handlePulse happens at most once per pulse interval.
|
// IOW handlePulse happens at most once per pulse interval.
|
||||||
unix.read(pulseFd, &expirationCount, expirationCount.sizeof);
|
unix.read(pulseFd, &expirationCount, expirationCount.sizeof);
|
||||||
|
forceXPending = true; // some events might have been added while the pulse was going off and xlib already read it from the fd (like as a result of a draw done in the timer handler). if so we need to flush that separately to ensure it is not delayed
|
||||||
} else if (fd == customEventFDRead) {
|
} else if (fd == customEventFDRead) {
|
||||||
// we have some custom events; process 'em
|
// we have some custom events; process 'em
|
||||||
import core.sys.posix.unistd : read;
|
import core.sys.posix.unistd : read;
|
||||||
|
@ -3282,6 +3285,7 @@ struct EventLoopImpl {
|
||||||
}
|
}
|
||||||
// if we won't call `XPending()` here, libX may delay some internal event delivery.
|
// if we won't call `XPending()` here, libX may delay some internal event delivery.
|
||||||
// i.e. we HAVE to repeatedly call `XPending()` even if libX fd wasn't signalled!
|
// i.e. we HAVE to repeatedly call `XPending()` even if libX fd wasn't signalled!
|
||||||
|
xpending:
|
||||||
if (!done && forceXPending) {
|
if (!done && forceXPending) {
|
||||||
this.mtLock();
|
this.mtLock();
|
||||||
scope(exit) this.mtUnlock();
|
scope(exit) this.mtUnlock();
|
||||||
|
|
Loading…
Reference in New Issue