mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-08 13:29:59 -05:00
iochannel: Avoid unnecessary wakeup after successful write
To save some CPU (in low latency scenarios), don't re-enable the "writable" event after it has succeeded. It is very likely the next write will succeed right away too. This means that we always need to handle EAGAIN/EWOULDBLOCK as a successful write of 0 bytes, so I also verified that all callers to pa_iochannel_write handled this correctly. Signed-off-by: David Henningsson <david.henningsson@canonical.com>
This commit is contained in:
parent
e2d1421f61
commit
9c4dcffca5
6 changed files with 17 additions and 21 deletions
|
|
@ -351,12 +351,9 @@ static int do_write(pa_ioline *l) {
|
|||
|
||||
while (l->io && !l->dead && pa_iochannel_is_writable(l->io) && l->wbuf_valid_length > 0) {
|
||||
|
||||
if ((r = pa_iochannel_write(l->io, l->wbuf+l->wbuf_index, l->wbuf_valid_length)) <= 0) {
|
||||
if ((r = pa_iochannel_write(l->io, l->wbuf+l->wbuf_index, l->wbuf_valid_length)) < 0) {
|
||||
|
||||
if (r < 0 && errno == EAGAIN)
|
||||
break;
|
||||
|
||||
if (r < 0 && errno != EPIPE)
|
||||
if (errno != EPIPE)
|
||||
pa_log("write(): %s", pa_cstrerror(errno));
|
||||
|
||||
failure(l, FALSE);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue