Skip to content
Commit 3904c876 authored by Colin Walters's avatar Colin Walters
Browse files

gmain: use Linux eventfd() for main context wake up

The Linux eventfd() call is basically tailor made for the main loop
wake up pipe - all we want is a threadsafe way to write to a file
descriptor, and wake up the context on the other end; we don't care
about the content at all.

The eventfd manual page basically explains the benefits:

       Applications can use an eventfd file descriptor instead of a
       pipe (see pipe(2)) in all cases where a pipe is used simply to
       signal events.  The kernel overhead of an eventfd file
       descriptor is much lower than that of a pipe, and only one file
       descriptor is required (versus the two required for a pipe).

When writing my multithreaded spawn test case I actually hit the 1024
file descriptor limit quickly, because we used 2 fds per main context.
This brings that down to 1.

https://bugzilla.gnome.org/show_bug.cgi?id=653140
parent 29bb7638
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment