mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-03 09:01:50 -05:00
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
This commit is contained in:
parent
350a253dc5
commit
860be2e70b
17 changed files with 100 additions and 58 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue