[haiku-commits] haiku: hrev45629 - src/kits/media

  • From: mmlr@xxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sun, 5 May 2013 21:17:29 +0200 (CEST)

hrev45629 adds 1 changeset to branch 'master'
old head: ab2e15ab8c0b54c6e8631e996566c5a32be14ed5
new head: ec4d0e426d0e022f6acc1aec831cb2c771354356
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=ec4d0e4+%5Eab2e15a

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

ec4d0e4: BMediaNode: Handle port read syscall interrupts by retrying.
  
  The syscall might be interrupted, especially in signal heavy
  applications. In that case we need to retry the read until the timeout
  runs out. since the timeout is already absolute we don't need to adjust
  anything.

                                            [ Michael Lotz <mmlr@xxxxxxxx> ]

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

Revision:    hrev45629
Commit:      ec4d0e426d0e022f6acc1aec831cb2c771354356
URL:         http://cgit.haiku-os.org/haiku/commit/?id=ec4d0e4
Author:      Michael Lotz <mmlr@xxxxxxxx>
Date:        Sun May  5 16:00:04 2013 UTC

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

1 file changed, 14 insertions(+), 4 deletions(-)
src/kits/media/MediaNode.cpp | 18 ++++++++++++++----

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

diff --git a/src/kits/media/MediaNode.cpp b/src/kits/media/MediaNode.cpp
index beb41e2..c4c67fc 100644
--- a/src/kits/media/MediaNode.cpp
+++ b/src/kits/media/MediaNode.cpp
@@ -364,13 +364,23 @@ BMediaNode::WaitForMessage(bigtime_t waitUntil,
 
        char data[B_MEDIA_MESSAGE_SIZE]; // about 16 KByte stack used
        int32 message;
-       ssize_t size = read_port_etc(ControlPort(), &message, data, 
sizeof(data),
-               B_ABSOLUTE_TIMEOUT, waitUntil);
-       if (size < 0) {
+       ssize_t size;
+       while (true) {
+               size = read_port_etc(ControlPort(), &message, data,
+                       sizeof(data), B_ABSOLUTE_TIMEOUT, waitUntil);
+
+               if (size >= 0)
+                       break;
+
                status_t error = (status_t)size;
-               if (error != B_TIMED_OUT && error != B_BAD_PORT_ID)
+               if (error == B_INTERRUPTED)
+                       continue;
+
+               if (error != B_TIMED_OUT && error != B_BAD_PORT_ID) {
                        ERROR("BMediaNode::WaitForMessage: read_port_etc error: 
%s\n",
                                strerror(error));
+               }
+
                return error;
        }
 


Other related posts:

  • » [haiku-commits] haiku: hrev45629 - src/kits/media - mmlr