From 4c4383379548e25763887d79b45576b015ece7b5 Mon Sep 17 00:00:00 2001 From: ghost Date: Mon, 11 Apr 2011 14:55:32 +0200 Subject: [PATCH] do call pthread_join before new pthread_create when the thread handle is valid fixes bug #749 --- lib/base/thread.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/base/thread.cpp b/lib/base/thread.cpp index fa923deb..1fda6a47 100644 --- a/lib/base/thread.cpp +++ b/lib/base/thread.cpp @@ -58,7 +58,12 @@ int eThread::runAsync(int prio, int policy) pthread_attr_setschedpolicy(&attr, policy); pthread_attr_setschedparam(&attr, &p); } - + + if (the_thread) { + eDebug("old thread joined %d", pthread_join(the_thread, 0)); + the_thread = 0; + } + if (pthread_create(&the_thread, &attr, wrapper, this)) { pthread_attr_destroy(&attr); @@ -69,7 +74,7 @@ int eThread::runAsync(int prio, int policy) pthread_attr_destroy(&attr); return 0; -} +} int eThread::run(int prio, int policy) { -- 2.30.2