--- old/lib/libthr/thread/thr_suspend_np.c 2016-05-03 10:28:49.724147269 +0000 +++ patched/lib/libthr/thread/thr_suspend_np.c 2016-05-03 10:27:23.133153259 +0000 @@ -116,8 +116,7 @@ TAILQ_FOREACH(thread, &_thread_list, tle) { if (thread != curthread) { THR_THREAD_LOCK(curthread, thread); - if (thread->state != PS_DEAD && - !(thread->flags & THR_FLAGS_SUSPENDED)) + if (thread->state != PS_DEAD) thread->flags |= THR_FLAGS_NEED_SUSPEND; THR_THREAD_UNLOCK(curthread, thread); } @@ -162,6 +161,9 @@ { uint32_t tmp; + if(thread->state != PS_DEAD) + thread->flags |= THR_FLAGS_NEED_SUSPEND; + while (thread->state != PS_DEAD && !(thread->flags & THR_FLAGS_SUSPENDED)) { thread->flags |= THR_FLAGS_NEED_SUSPEND;