summaryrefslogtreecommitdiffstats
path: root/src/pulse
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2006-07-14 22:42:01 +0000
committerLennart Poettering <lennart@poettering.net>2006-07-14 22:42:01 +0000
commit860be2e70b33ff5eeb9130f80c4b1c096a2a8f27 (patch)
treea3193083ecdb5055a4536c22ea394c8243731571 /src/pulse
parent350a253dc559956b63ced4e602b1040ccba66f98 (diff)
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
Diffstat (limited to 'src/pulse')
-rw-r--r--src/pulse/mainloop-signal.c4
-rw-r--r--src/pulse/mainloop.c6
-rw-r--r--src/pulse/xmalloc.c2
3 files changed, 7 insertions, 5 deletions
diff --git a/src/pulse/mainloop-signal.c b/src/pulse/mainloop-signal.c
index c3cf362d..11a27cd5 100644
--- a/src/pulse/mainloop-signal.c
+++ b/src/pulse/mainloop-signal.c
@@ -67,7 +67,7 @@ static void signal_handler(int sig) {
#ifndef HAVE_SIGACTION
signal(sig, signal_handler);
#endif
- pa_write(signal_pipe[1], &sig, sizeof(sig));
+ pa_write(signal_pipe[1], &sig, sizeof(sig), NULL);
}
static void dispatch(pa_mainloop_api*a, int sig) {
@@ -86,7 +86,7 @@ static void callback(pa_mainloop_api*a, pa_io_event*e, int fd, pa_io_event_flags
int sig;
assert(a && e && f == PA_IO_EVENT_INPUT && e == io_event && fd == signal_pipe[0]);
- if ((r = pa_read(signal_pipe[0], &sig, sizeof(sig))) < 0) {
+ if ((r = pa_read(signal_pipe[0], &sig, sizeof(sig), NULL)) < 0) {
if (errno == EAGAIN)
return;
diff --git a/src/pulse/mainloop.c b/src/pulse/mainloop.c
index 32f1a845..dfbc337b 100644
--- a/src/pulse/mainloop.c
+++ b/src/pulse/mainloop.c
@@ -100,6 +100,7 @@ struct pa_mainloop {
int deferred_pending;
int wakeup_pipe[2];
+ int wakeup_pipe_type;
enum {
STATE_PASSIVE,
@@ -337,6 +338,7 @@ pa_mainloop *pa_mainloop_new(void) {
m = pa_xmalloc(sizeof(pa_mainloop));
+ m->wakeup_pipe_type = 0;
if (pipe(m->wakeup_pipe) < 0) {
pa_log_error(__FILE__": ERROR: cannot create wakeup pipe");
pa_xfree(m);
@@ -625,7 +627,7 @@ void pa_mainloop_wakeup(pa_mainloop *m) {
assert(m);
if (m->wakeup_pipe[1] >= 0)
- pa_write(m->wakeup_pipe[1], &c, sizeof(c));
+ pa_write(m->wakeup_pipe[1], &c, sizeof(c), &m->wakeup_pipe_type);
}
static void clear_wakeup(pa_mainloop *m) {
@@ -636,7 +638,7 @@ static void clear_wakeup(pa_mainloop *m) {
if (m->wakeup_pipe[0] < 0)
return;
- while (pa_read(m->wakeup_pipe[0], &c, sizeof(c)) == sizeof(c));
+ while (pa_read(m->wakeup_pipe[0], &c, sizeof(c), &m->wakeup_pipe_type) == sizeof(c));
}
int pa_mainloop_prepare(pa_mainloop *m, int timeout) {
diff --git a/src/pulse/xmalloc.c b/src/pulse/xmalloc.c
index 46871aeb..36755166 100644
--- a/src/pulse/xmalloc.c
+++ b/src/pulse/xmalloc.c
@@ -49,7 +49,7 @@ static void oom(void) PA_GCC_NORETURN;
* exits */
static void oom(void) {
static const char e[] = "Not enough memory\n";
- pa_loop_write(STDERR_FILENO, e, sizeof(e)-1);
+ pa_loop_write(STDERR_FILENO, e, sizeof(e)-1, NULL);
#ifdef SIGQUIT
raise(SIGQUIT);
#endif