summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtem Nosach (GitHub) <ANosach@luxoft.com>2016-08-04 18:19:11 +0300
committerGitHub <noreply@github.com>2016-08-04 18:19:11 +0300
commitf5f18f7777c91ed300bed6139a15e6e8cb1cd2e5 (patch)
tree235d4fc6c5f48f8333cfb9b96601184fdb0ac07c
parent3707539b0b4fb382db6d447e04bfcc34bbebde2e (diff)
parentd1724eb27f53fb746e8179641c3645fb8a15a65a (diff)
downloadsdl_core-f5f18f7777c91ed300bed6139a15e6e8cb1cd2e5.tar.gz
Merge pull request #549 from madhuy/hotfix/452
fix for pthread_join() crash in some platforms
-rw-r--r--src/components/utils/src/threads/posix_thread.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/components/utils/src/threads/posix_thread.cc b/src/components/utils/src/threads/posix_thread.cc
index 3972a40eb1..8f481a82f3 100644
--- a/src/components/utils/src/threads/posix_thread.cc
+++ b/src/components/utils/src/threads/posix_thread.cc
@@ -272,7 +272,11 @@ Thread::~Thread() {
finalized_ = true;
stopped_ = true;
join();
- pthread_join(handle_, NULL);
+ // in some platforms pthread_join behaviour is undefined when thread is
+ // not created(pthread_create) and call pthread_join.
+ if(handle_) {
+ pthread_join(handle_, NULL);
+ }
}
Thread* CreateThread(const char* name, ThreadDelegate* delegate) {