mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-04-30 06:46:45 -04:00
fdm: use poll(3) instead of epoll_wait(2)
poll() is more portable, and since foot doesn’t use _that_ many FDs, there should be no noticeable performance difference between the two.
This commit is contained in:
parent
e19db15104
commit
4fa4d54d2b
9 changed files with 204 additions and 165 deletions
8
reaper.c
8
reaper.c
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/epoll.h>
|
||||
#include <poll.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/signalfd.h>
|
||||
#include <tllist.h>
|
||||
|
|
@ -60,7 +60,7 @@ reaper_init(struct fdm *fdm)
|
|||
.children = tll_init(),
|
||||
};
|
||||
|
||||
if (!fdm_add(fdm, fd, EPOLLIN, &fdm_reap, reaper)){
|
||||
if (!fdm_add(fdm, fd, POLLIN, &fdm_reap, reaper)){
|
||||
LOG_ERR("failed to register with the FDM");
|
||||
goto err;
|
||||
}
|
||||
|
|
@ -115,8 +115,8 @@ fdm_reap(struct fdm *fdm, int fd, int events, void *data)
|
|||
{
|
||||
struct reaper *reaper = data;
|
||||
|
||||
bool pollin = events & EPOLLIN;
|
||||
bool hup = events & EPOLLHUP;
|
||||
bool pollin = events & POLLIN;
|
||||
bool hup = events & POLLHUP;
|
||||
|
||||
if (hup && !pollin)
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue