summaryrefslogtreecommitdiff
path: root/cpp/src/IceUtil/CtrlCHandler.cpp
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2012-12-27 23:20:00 +0100
committerJose <jose@zeroc.com>2012-12-27 23:20:00 +0100
commit05fe914f6f78c8f7bb3f4530d68b2926bf2cea51 (patch)
treef171ab75496f6dc5e5b2cec5e92f8a46049e9a1d /cpp/src/IceUtil/CtrlCHandler.cpp
parentFixed (ICE-5161) - Strange xxx ruby library names (diff)
downloadice-05fe914f6f78c8f7bb3f4530d68b2926bf2cea51.tar.bz2
ice-05fe914f6f78c8f7bb3f4530d68b2926bf2cea51.tar.xz
ice-05fe914f6f78c8f7bb3f4530d68b2926bf2cea51.zip
Fixed warnings related to ICE-5157
Diffstat (limited to 'cpp/src/IceUtil/CtrlCHandler.cpp')
-rw-r--r--cpp/src/IceUtil/CtrlCHandler.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/cpp/src/IceUtil/CtrlCHandler.cpp b/cpp/src/IceUtil/CtrlCHandler.cpp
index a6f2c6e9329..196fe499240 100644
--- a/cpp/src/IceUtil/CtrlCHandler.cpp
+++ b/cpp/src/IceUtil/CtrlCHandler.cpp
@@ -224,19 +224,31 @@ CtrlCHandler::CtrlCHandler(CtrlCHandlerCallback callback)
sigaddset(&ctrlCLikeSignals, SIGHUP);
sigaddset(&ctrlCLikeSignals, SIGINT);
sigaddset(&ctrlCLikeSignals, SIGTERM);
+
+#ifndef NDEBUG
int rc = pthread_sigmask(SIG_BLOCK, &ctrlCLikeSignals, 0);
assert(rc == 0);
// Joinable thread
rc = pthread_create(&_tid, 0, sigwaitThread, 0);
assert(rc == 0);
+#else
+ pthread_sigmask(SIG_BLOCK, &ctrlCLikeSignals, 0);
+
+ // Joinable thread
+ pthread_create(&_tid, 0, sigwaitThread, 0);
+#endif
}
}
CtrlCHandler::~CtrlCHandler()
{
+#ifndef NDEBUG
int rc = pthread_cancel(_tid);
assert(rc == 0);
+#else
+ pthread_cancel(_tid);
+#endif
#if defined(__APPLE__)
//
// WORKAROUND: sigwait isn't a cancellation point on OS X, see
@@ -246,8 +258,14 @@ CtrlCHandler::~CtrlCHandler()
//assert(rc == 0); For some reaosns, this assert is sometime triggered
#endif
void* status = 0;
+
+#ifndef NDEBUG
rc = pthread_join(_tid, &status);
assert(rc == 0);
+#else
+ pthread_join(_tid, &status);
+#endif
+
#if !defined(__APPLE__)
assert(status == PTHREAD_CANCELED);
#endif