From 860be2e70b33ff5eeb9130f80c4b1c096a2a8f27 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 14 Jul 2006 22:42:01 +0000 Subject: try to use send(,,MSG_NOSIGNAL) instead of write() wherever possible (which will allow us to drop the SIGPIPE check). Cache the results of the last write()/send() to make sure that we do not issue more than necessary system calls. git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1083 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/pulsecore/iochannel.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/pulsecore/iochannel.c') diff --git a/src/pulsecore/iochannel.c b/src/pulsecore/iochannel.c index 8a19094a..842c0e6a 100644 --- a/src/pulsecore/iochannel.c +++ b/src/pulsecore/iochannel.c @@ -49,6 +49,7 @@ struct pa_iochannel { int ifd, ofd; + int ifd_type, ofd_type; pa_mainloop_api* mainloop; pa_iochannel_cb_t callback; @@ -127,6 +128,7 @@ pa_iochannel* pa_iochannel_new(pa_mainloop_api*m, int ifd, int ofd) { io = pa_xnew(pa_iochannel, 1); io->ifd = ifd; io->ofd = ofd; + io->ifd_type = io->ofd_type = 0; io->mainloop = m; io->userdata = NULL; @@ -204,7 +206,7 @@ ssize_t pa_iochannel_write(pa_iochannel*io, const void*data, size_t l) { assert(l); assert(io->ofd >= 0); - r = pa_write(io->ofd, data, l); + r = pa_write(io->ofd, data, l, &io->ofd_type); if (r >= 0) { io->writable = 0; enable_mainloop_sources(io); @@ -220,7 +222,7 @@ ssize_t pa_iochannel_read(pa_iochannel*io, void*data, size_t l) { assert(data); assert(io->ifd >= 0); - r = pa_read(io->ifd, data, l); + r = pa_read(io->ifd, data, l, &io->ifd_type); if (r >= 0) { io->readable = 0; enable_mainloop_sources(io); -- cgit