[Prevent] Handle return value from pthread_setspecific.
authorJan Olszak <j.olszak@samsung.com>
Fri, 28 Dec 2012 08:49:46 +0000 (09:49 +0100)
committerGerrit Code Review <gerrit2@kim11>
Mon, 31 Dec 2012 08:04:03 +0000 (17:04 +0900)
[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

index 8dacad6..3974406 100644 (file)
@@ -27,6 +27,7 @@
 #include <dpl/assert.h>
 #include <errno.h>
 #include <time.h>
+#include <string.h>
 
 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