mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-04-25 06:46:36 -04:00
wayland: wayl_flush: re-initialize fd array before each poll
This commit is contained in:
parent
11d381f0c3
commit
ae82939158
1 changed files with 13 additions and 5 deletions
18
wayland.c
18
wayland.c
|
|
@ -1004,22 +1004,30 @@ wayl_flush(struct wayland *wayl)
|
||||||
{
|
{
|
||||||
while (true) {
|
while (true) {
|
||||||
int r = wl_display_flush(wayl->display);
|
int r = wl_display_flush(wayl->display);
|
||||||
if (r >= 0)
|
if (r >= 0) {
|
||||||
|
/* Most likely code path - the flush succeed */
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (errno == EINTR)
|
if (errno == EINTR) {
|
||||||
|
/* Unlikely */
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (errno != EAGAIN) {
|
if (errno != EAGAIN) {
|
||||||
LOG_ERRNO("failed to flush wayland socket");
|
LOG_ERRNO("failed to flush wayland socket");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct pollfd fds[] = {
|
/* Socket buffer is full - need to wait for it to become
|
||||||
{.fd = wl_display_get_fd(wayl->display), .events = POLLOUT}
|
writeable again */
|
||||||
};
|
assert(errno == EAGAIN);
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
|
struct pollfd fds[] = {
|
||||||
|
{.fd = wl_display_get_fd(wayl->display), .events = POLLOUT},
|
||||||
|
};
|
||||||
|
|
||||||
r = poll(fds, sizeof(fds) / sizeof(fds[0]), -1);
|
r = poll(fds, sizeof(fds) / sizeof(fds[0]), -1);
|
||||||
|
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue