[prev in list] [next in list] [prev in thread] [next in thread] 

List:       zeromq-dev
Subject:    [zeromq-dev] [PATCH] Testing for errors from pthread_* functions
From:       Martin Sustrik <sustrik () 250bpm ! com>
Date:       2011-06-29 22:06:45
Message-ID: 4E0BA1F5.7050003 () 250bpm ! com
[Download RAW message or body]

["0001-Testing-for-errors-from-pthread_-functions-fixed.patch" (text/x-diff)]

From de3838403b9a35e7131aae23519ced1f11a3e03c Mon Sep 17 00:00:00 2001
From: Martin Sustrik <sustrik@250bpm.com>
Date: Thu, 30 Jun 2011 00:05:03 +0200
Subject: [PATCH] Testing for errors from pthread_* functions fixed

pthread_* functions return the error number rather than
setting errno. This was not accounter for till now.

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
---
 src/thread.cpp |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/thread.cpp b/src/thread.cpp
index 7bf9df0..06a47fc 100644
--- a/src/thread.cpp
+++ b/src/thread.cpp
@@ -66,7 +66,7 @@ extern "C"
         int rc = sigfillset (&signal_set);
         errno_assert (rc == 0);
         rc = pthread_sigmask (SIG_BLOCK, &signal_set, NULL);
-        errno_assert (rc == 0);
+        posix_assert (rc);
     #endif
 
         zmq::thread_t *self = (zmq::thread_t*) arg_;   
@@ -80,13 +80,13 @@ void zmq::thread_t::start (thread_fn *tfn_, void *arg_)
     tfn = tfn_;
     arg =arg_;
     int rc = pthread_create (&descriptor, NULL, thread_routine, this);
-    errno_assert (rc == 0);
+    posix_assert (rc);
 }
 
 void zmq::thread_t::stop ()
 {
     int rc = pthread_join (descriptor, NULL);
-    errno_assert (rc == 0);
+    posix_assert (rc);
 }
 
 #endif
-- 
1.7.0.4



_______________________________________________
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic