mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-04-29 06:46:35 -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
6
render.c
6
render.c
|
|
@ -3,11 +3,11 @@
|
|||
#include <string.h>
|
||||
#include <wctype.h>
|
||||
#include <unistd.h>
|
||||
#include <poll.h>
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/timerfd.h>
|
||||
#include <sys/epoll.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#include "macros.h"
|
||||
|
|
@ -2727,7 +2727,7 @@ fdm_tiocswinsz(struct fdm *fdm, int fd, int events, void *data)
|
|||
{
|
||||
struct terminal *term = data;
|
||||
|
||||
if (events & EPOLLIN)
|
||||
if (events & POLLIN)
|
||||
tiocswinsz(term);
|
||||
|
||||
fdm_del(fdm, fd);
|
||||
|
|
@ -2762,7 +2762,7 @@ send_dimensions_to_client(struct terminal *term)
|
|||
fd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC | TFD_NONBLOCK);
|
||||
if (fd < 0)
|
||||
LOG_ERRNO("failed to create TIOCSWINSZ timer");
|
||||
else if (!fdm_add(term->fdm, fd, EPOLLIN, &fdm_tiocswinsz, term)) {
|
||||
else if (!fdm_add(term->fdm, fd, POLLIN, &fdm_tiocswinsz, term)) {
|
||||
close(fd);
|
||||
fd = -1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue