mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
Fix poll zero timeout not being instant wakeup.
This commit is contained in:
parent
40594eba1c
commit
2291076f19
2 changed files with 6 additions and 4 deletions
|
@ -208,7 +208,7 @@ int sys_ppoll(struct pollfd* user_fds, nfds_t nfds,
|
||||||
volatile bool remote_woken = false;
|
volatile bool remote_woken = false;
|
||||||
bool unexpected_error = false;
|
bool unexpected_error = false;
|
||||||
|
|
||||||
nfds_t reqs = nfds;
|
nfds_t reqs;
|
||||||
for ( reqs = 0; !unexpected_error && reqs < nfds; )
|
for ( reqs = 0; !unexpected_error && reqs < nfds; )
|
||||||
{
|
{
|
||||||
PollNode* node = nodes + reqs;
|
PollNode* node = nodes + reqs;
|
||||||
|
@ -234,11 +234,13 @@ int sys_ppoll(struct pollfd* user_fds, nfds_t nfds,
|
||||||
// TODO: How should errors be handled?
|
// TODO: How should errors be handled?
|
||||||
if ( desc->poll(&ctx, node) == 0 )
|
if ( desc->poll(&ctx, node) == 0 )
|
||||||
self_woken = true;
|
self_woken = true;
|
||||||
else if ( errno != EAGAIN )
|
else if ( errno == EAGAIN )
|
||||||
|
errno = 0;
|
||||||
|
else
|
||||||
unexpected_error = self_woken = true;
|
unexpected_error = self_woken = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( timeout_ts.tv_sec < 0 )
|
if ( timeout_ts.tv_sec == 0 )
|
||||||
self_woken = true;
|
self_woken = true;
|
||||||
|
|
||||||
while ( !(self_woken || remote_woken) )
|
while ( !(self_woken || remote_woken) )
|
||||||
|
|
|
@ -1784,7 +1784,7 @@ static void HandleEvents(int kbfd, struct Desktop* desktop)
|
||||||
fds[0].fd = kbfd;
|
fds[0].fd = kbfd;
|
||||||
fds[0].events = POLLIN;
|
fds[0].events = POLLIN;
|
||||||
fds[0].revents = 0;
|
fds[0].revents = 0;
|
||||||
if ( 0 < poll(fds, NFDS, -1) )
|
if ( 0 < poll(fds, NFDS, 0) )
|
||||||
{
|
{
|
||||||
if ( fds[0].revents )
|
if ( fds[0].revents )
|
||||||
HandleKeyboardEvents(kbfd, desktop);
|
HandleKeyboardEvents(kbfd, desktop);
|
||||||
|
|
Loading…
Reference in a new issue