mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-04 13:29:59 -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
|
|
@ -81,6 +81,7 @@ struct userdata {
|
|||
int quit_requested;
|
||||
|
||||
int pipe_fds[2];
|
||||
int pipe_fd_type;
|
||||
pa_io_event *io_event;
|
||||
|
||||
jack_nframes_t frames_in_buffer;
|
||||
|
|
@ -119,7 +120,7 @@ static void io_event_cb(pa_mainloop_api *m, pa_io_event *e, int fd, pa_io_event_
|
|||
assert(u);
|
||||
assert(u->pipe_fds[0] == fd);
|
||||
|
||||
read(fd, &x, 1);
|
||||
pa_read(fd, &x, 1, &u->pipe_fd_type);
|
||||
|
||||
if (u->quit_requested) {
|
||||
stop_source(u);
|
||||
|
|
@ -166,7 +167,7 @@ static void request_post(struct userdata *u) {
|
|||
assert(u);
|
||||
|
||||
assert(u->pipe_fds[1] >= 0);
|
||||
write(u->pipe_fds[1], &c, 1);
|
||||
pa_write(u->pipe_fds[1], &c, 1, &u->pipe_fd_type);
|
||||
}
|
||||
|
||||
static void jack_shutdown(void *arg) {
|
||||
|
|
@ -266,6 +267,7 @@ int pa__init(pa_core *c, pa_module*m) {
|
|||
u->core = c;
|
||||
u->module = m;
|
||||
u->pipe_fds[0] = u->pipe_fds[1] = -1;
|
||||
u->pipe_fd_type = 0;
|
||||
|
||||
pthread_mutex_init(&u->mutex, NULL);
|
||||
pthread_cond_init(&u->cond, NULL);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue