From 61a3315c3bf23d3a69c04e1bcbe115f927298255 Mon Sep 17 00:00:00 2001 From: Jan Olszak Date: Fri, 28 Dec 2012 09:49:46 +0100 Subject: [PATCH] [Prevent] Handle return value from pthread_setspecific. [Issue] Unhandled return value from pthread_setspecific [Bug] N/A [Cause] N/A [Solution] Log on errors. [Verification] Build commons. Change-Id: I9994b421626df10a27eef90899dc0645120c765d --- modules/core/src/thread.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/core/src/thread.cpp b/modules/core/src/thread.cpp index 8dacad6..3974406 100644 --- a/modules/core/src/thread.cpp +++ b/modules/core/src/thread.cpp @@ -27,6 +27,7 @@ #include #include #include +#include namespace // anonymous { @@ -118,7 +119,12 @@ void *Thread::StaticThreadEntry(void *param) Assert(This != NULL); // Set thread specific - pthread_setspecific(g_threadSpecific.threadSpecific, This); + int result = pthread_setspecific(g_threadSpecific.threadSpecific, This); + + if (result!=0) + { + LogError("Failed to set threadSpecific. Error: " << strerror(result)); + } // Enter thread proc // Do not allow exceptions to hit pthread core -- 2.7.4