[pulseaudio-discuss] [PATCH] core: Remember pa_write() type in pa_fdsem_post()
Tanu Kaskinen
tanuk at iki.fi
Wed Apr 10 05:00:11 PDT 2013
On Tue, 2013-04-09 at 16:10 +0200, Peter Meerwald wrote:
> From: Peter Meerwald <p.meerwald at bct-electronic.com>
>
> pa_write() knows two types of operation:
> calling send() and calling write()
>
> there is a flag (a pointer to an int) passed to pa_write()
> which can remember which write type was successful
>
> if the pointer is NULL or the int is 0, send() is tried first,
> with a fallback to write() if send() resulted in ENOTSOCK
>
> pa_fdsem_post() calls pa_write() with a NULL pointer;
> unfortunately (at least with HAVE_SYS_EVENTFD_H #define'd) send()
> always fails here and write() is called -- causing an extra syscall
> quite frequently
>
> strace:
> send(17, "\1\0\0\0\0\0\0\0", 8, MSG_NOSIGNAL) = -1 ENOTSOCK (Socket operation on non-socket)
> write(17, "\1\0\0\0\0\0\0\0", 8) = 8
>
> the patch adds a write_type field to pa_fdsem to the successful
> pa_write() type can be remembered and unnecessary send() calls are
> avoided
>
> Signed-off-by: Peter Meerwald <p.meerwald at bct-electronic.com>
> ---
> src/pulsecore/fdsem.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
Thanks, applied to the "next" branch. I fixed the issue that Thomas
pointed out.
--
Tanu
More information about the pulseaudio-discuss
mailing list