diff options
Diffstat (limited to 'src/components/utils/src/threads/posix_thread.cc')
-rw-r--r-- | src/components/utils/src/threads/posix_thread.cc | 6 |
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 e44b286b33..51e59fa108 100644 --- a/src/components/utils/src/threads/posix_thread.cc +++ b/src/components/utils/src/threads/posix_thread.cc @@ -286,7 +286,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) { |