diff options
author | Lennart Poettering <lennart@poettering.net> | 2007-06-14 20:11:46 +0000 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2007-06-14 20:11:46 +0000 |
commit | 1c62ce6f860804cfb87aaef591d48f07dc36bbd2 (patch) | |
tree | f919c21607c2e0d1320f32f0a7f072f2bc93e6d5 /src | |
parent | 572c77f41822be193db603dd3c2d6f0f3ca9fa92 (diff) |
Fix a nasty typo in pa_asyncq_pop
git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/lennart@1480 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'src')
-rw-r--r-- | src/pulsecore/asyncq.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/pulsecore/asyncq.c b/src/pulsecore/asyncq.c index da1f16fb..c966e7dd 100644 --- a/src/pulsecore/asyncq.c +++ b/src/pulsecore/asyncq.c @@ -141,8 +141,10 @@ int pa_asyncq_push(pa_asyncq*l, void *p, int wait) { int x[20]; errno = 0; - if ((r = read(l->write_fds[0], x, sizeof(x))) <= 0 && errno != EINTR) + if ((r = read(l->write_fds[0], x, sizeof(x))) < 0 && errno != EINTR) return -1; + + pa_assert(r != 0); if (r > 0) if (pa_atomic_sub(&l->n_read, r) <= r) @@ -174,6 +176,8 @@ int pa_asyncq_push(pa_asyncq*l, void *p, int wait) { return -1; } + pa_assert(r != 0); + if (r > 0) pa_atomic_sub(&l->n_read, r); } @@ -220,8 +224,10 @@ void* pa_asyncq_pop(pa_asyncq*l, int wait) { int x[20]; errno = 0; - if ((r = read(l->read_fds[0], x, sizeof(x))) <= 0 && errno != EINTR) + if ((r = read(l->read_fds[0], x, sizeof(x))) < 0 && errno != EINTR) return NULL; + + pa_assert(r != 0); if (r > 0) if (pa_atomic_sub(&l->n_written, r) <= r) @@ -246,11 +252,13 @@ void* pa_asyncq_pop(pa_asyncq*l, int wait) { _Y; - if ((r = read(l->read_fds[0], x, sizeof(x)) < 0) && errno != EINTR) { + if ((r = read(l->read_fds[0], x, sizeof(x))) < 0 && errno != EINTR) { pa_atomic_dec(&l->read_waiting); return NULL; } + pa_assert(r != 0); + if (r > 0) pa_atomic_sub(&l->n_written, r); } @@ -312,7 +320,4 @@ void pa_asyncq_after_poll(pa_asyncq *l) { pa_assert(pa_atomic_load(&l->read_waiting) > 0); pa_atomic_dec(&l->read_waiting); - - - } |