[pulseaudio-commits] [SCM] PulseAudio Sound Server branch, master, updated. v0.9.16-test4-83-g01e4b61

Lennart Poettering gitmailer-noreply at 0pointer.de
Sat Aug 15 17:02:31 PDT 2009


This is an automated email from the git hooks/post-receive script. It was
generated because of a push to the "PulseAudio Sound Server" repository.

The master branch has been updated
      from  8dd0d871a7dd2d97c63ec8e38e1b408637d1b639 (commit)

- Log -----------------------------------------------------------------
01e4b61 aupdate: implicitly call _write_swap() if it wasn't called explicitly
-----------------------------------------------------------------------

Summary of changes:
 src/pulsecore/aupdate.c |    8 ++++++++
 src/pulsecore/aupdate.h |    4 ++++
 2 files changed, 12 insertions(+), 0 deletions(-)

-----------------------------------------------------------------------

commit 01e4b61a910afdd21f860fadbe98075735c2bf51
Author: Lennart Poettering <lennart at poettering.net>
Date:   Sun Aug 16 02:02:51 2009 +0200

    aupdate: implicitly call _write_swap() if it wasn't called explicitly

diff --git a/src/pulsecore/aupdate.c b/src/pulsecore/aupdate.c
index 56ebb8e..85b6e00 100644
--- a/src/pulsecore/aupdate.c
+++ b/src/pulsecore/aupdate.c
@@ -39,6 +39,7 @@ struct pa_aupdate {
     pa_atomic_t read_lock;
     pa_mutex *write_lock;
     pa_semaphore *semaphore;
+    pa_bool_t swapped;
 };
 
 pa_aupdate *pa_aupdate_new(void) {
@@ -101,6 +102,8 @@ unsigned pa_aupdate_write_begin(pa_aupdate *a) {
 
     n = (unsigned) pa_atomic_load(&a->read_lock);
 
+    a->swapped = FALSE;
+
     return !WHICH(n);
 }
 
@@ -119,11 +122,16 @@ unsigned pa_aupdate_write_swap(pa_aupdate *a) {
             break;
     }
 
+    a->swapped = TRUE;
+
     return WHICH(n);
 }
 
 void pa_aupdate_write_end(pa_aupdate *a) {
     pa_assert(a);
 
+    if (!a->swapped)
+        pa_aupdate_write_swap(a);
+
     pa_mutex_unlock(a->write_lock);
 }
diff --git a/src/pulsecore/aupdate.h b/src/pulsecore/aupdate.h
index 072e382..fb38ffa 100644
--- a/src/pulsecore/aupdate.h
+++ b/src/pulsecore/aupdate.h
@@ -93,6 +93,10 @@ unsigned pa_aupdate_write_swap(pa_aupdate *a);
  *    pa_update_write_end(a)
  * }
  *
+ * In some cases keeping both structures up-to-date might not be
+ * necessary, since they are fully rebuilt on each iteration
+ * anyway. In that case you may leave the _write_swap() call out, it
+ * will then be done implicitly in the _write_end() invocation.
  */
 
 #endif

-- 
hooks/post-receive
PulseAudio Sound Server



More information about the pulseaudio-commits mailing list