mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-27 06:26:15 +01:00
gwakeup: Use O_NONBLOCK to avoid a fcntl() syscall where possible
Create the wakeup pipe using the `O_NONBLOCK` flag for `pipe2()`, where possible. This saves a couple of `fcntl()` syscalls every time a wakeup pipe is created, which is at least once per `GMainContext`. This uses the `O_NONBLOCK` support added to `g_unix_open_pipe()` in the previous commit. Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
This commit is contained in:
parent
5c65437d73
commit
aab9cea326
@ -160,7 +160,7 @@ g_wakeup_new (void)
|
||||
/* for any failure, try a pipe instead */
|
||||
#endif
|
||||
|
||||
if (!g_unix_open_pipe (wakeup->fds, FD_CLOEXEC, &error))
|
||||
if (!g_unix_open_pipe (wakeup->fds, FD_CLOEXEC | O_NONBLOCK, &error))
|
||||
g_error ("Creating pipes for GWakeup: %s", error->message);
|
||||
|
||||
if (!g_unix_set_fd_nonblocking (wakeup->fds[0], TRUE, &error) ||
|
||||
|
Loading…
Reference in New Issue
Block a user