[pulseaudio-commits] [SCM] PulseAudio Sound Server branch, master, updated. v0.9.15-5-g12c5afe

Lennart Poettering gitmailer-noreply at 0pointer.de
Sat Apr 18 14:24:42 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  099b3284ec7e78da25baa70d42a2ecdc1092b935 (commit)

- Log -----------------------------------------------------------------
12c5afe object: keep refcount at 1 while destructing objects
ad447d1 core-util: handle EINTR already inside of pa_read/pa_write
-----------------------------------------------------------------------

Summary of changes:
 src/pulsecore/core-util.c |   39 ++++++++++++++++++++++++++++++++-------
 src/pulsecore/object.c    |    9 ++++++---
 2 files changed, 38 insertions(+), 10 deletions(-)

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

commit ad447d14682a57defb7a06069dec0c1fd91108de
Author: Lennart Poettering <lennart at poettering.net>
Date:   Sat Apr 18 23:21:05 2009 +0200

    core-util: handle EINTR already inside of pa_read/pa_write

diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c
index 24d929d..294f63c 100644
--- a/src/pulsecore/core-util.c
+++ b/src/pulsecore/core-util.c
@@ -296,7 +296,15 @@ ssize_t pa_read(int fd, void *buf, size_t count, int *type) {
 
 #endif
 
-    return read(fd, buf, count);
+    for (;;) {
+        ssize_t r;
+
+        if ((r = read(fd, buf, count)) < 0)
+            if (errno == EINTR)
+                continue;
+
+        return r;
+    }
 }
 
 /** Similar to pa_read(), but handles writes */
@@ -305,8 +313,17 @@ ssize_t pa_write(int fd, const void *buf, size_t count, int *type) {
     if (!type || *type == 0) {
         ssize_t r;
 
-        if ((r = send(fd, buf, count, MSG_NOSIGNAL)) >= 0)
+        for (;;) {
+            if ((r = send(fd, buf, count, MSG_NOSIGNAL)) < 0) {
+
+                if (errno == EINTR)
+                    continue;
+
+                break;
+            }
+
             return r;
+        }
 
 #ifdef OS_IS_WIN32
         if (WSAGetLastError() != WSAENOTSOCK) {
@@ -322,7 +339,15 @@ ssize_t pa_write(int fd, const void *buf, size_t count, int *type) {
             *type = 1;
     }
 
-    return write(fd, buf, count);
+    for (;;) {
+        ssize_t r;
+
+        if ((r = write(fd, buf, count)) < 0)
+            if (errno == EINTR)
+                continue;
+
+        return r;
+    }
 }
 
 /** Calls read() in a loop. Makes sure that as much as 'size' bytes,
@@ -407,11 +432,11 @@ int pa_close(int fd) {
     for (;;) {
         int r;
 
-        if ((r = close(fd)) >= 0)
-            return r;
+        if ((r = close(fd)) < 0)
+            if (errno == EINTR)
+                continue;
 
-        if (errno != EINTR)
-            return r;
+        return r;
     }
 }
 

commit 12c5afe0382ded41de5283e0a8711155adf7ee64
Author: Lennart Poettering <lennart at poettering.net>
Date:   Sat Apr 18 23:24:36 2009 +0200

    object: keep refcount at 1 while destructing objects

diff --git a/src/pulsecore/object.c b/src/pulsecore/object.c
index 8fd05fb..29cca0a 100644
--- a/src/pulsecore/object.c
+++ b/src/pulsecore/object.c
@@ -24,6 +24,8 @@
 #include <config.h>
 #endif
 
+#include <pulsecore/core-util.h>
+
 #include "object.h"
 
 pa_object *pa_object_new_internal(size_t size, const char *type_name, int (*check_type)(const char *type_name)) {
@@ -57,14 +59,15 @@ pa_object *pa_object_ref(pa_object *o) {
 void pa_object_unref(pa_object *o) {
     pa_object_assert_ref(o);
 
-    if (PA_REFCNT_DEC(o) <= 0) {
+    if (PA_REFCNT_VALUE(o) == 1) {
         pa_assert(o->free);
         o->free(o);
-    }
+    } else
+        pa_assert_se(PA_REFCNT_DEC(o) == 0);
 }
 
 int pa_object_check_type(const char *type_name) {
     pa_assert(type_name);
 
-    return strcmp(type_name, "pa_object") == 0;
+    return pa_streq(type_name, "pa_object");
 }

-- 
hooks/post-receive
PulseAudio Sound Server



More information about the pulseaudio-commits mailing list