mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-06-20 11:14:50 +02:00
Merge branch 'backport-3624-wakeup-eintr-glib-2-78' into 'glib-2-78'
Backport !3624 “wakeup: Fix g_wakeup_acknowledge if signal comes in” to glib-2-78 See merge request GNOME/glib!3625
This commit is contained in:
commit
4b39ae7b6e
@ -207,20 +207,25 @@ g_wakeup_get_pollfd (GWakeup *wakeup,
|
||||
void
|
||||
g_wakeup_acknowledge (GWakeup *wakeup)
|
||||
{
|
||||
/* read until it is empty */
|
||||
int res;
|
||||
|
||||
if (wakeup->fds[1] == -1)
|
||||
{
|
||||
uint64_t value;
|
||||
|
||||
/* eventfd() read resets counter */
|
||||
read (wakeup->fds[0], &value, sizeof (value));
|
||||
do
|
||||
res = read (wakeup->fds[0], &value, sizeof (value));
|
||||
while (G_UNLIKELY (res == -1 && errno == EINTR));
|
||||
}
|
||||
else
|
||||
{
|
||||
uint8_t value;
|
||||
|
||||
while (read (wakeup->fds[0], &value, sizeof (value)) == sizeof (value));
|
||||
/* read until it is empty */
|
||||
do
|
||||
res = read (wakeup->fds[0], &value, sizeof (value));
|
||||
while (res == sizeof (value) || G_UNLIKELY (res == -1 && errno == EINTR));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user