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
Please register or sign in to comment