From aa526a53635a3c18aa9d864998330d062526b5b4 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 27 Mar 2017 15:21:06 -0500 Subject: [PATCH] FS-10167 auto change state when joining a thread out of the blue --- libs/libks/src/ks_thread.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libs/libks/src/ks_thread.c b/libs/libks/src/ks_thread.c index 92c608bd27..db1b690fa2 100644 --- a/libs/libks/src/ks_thread.c +++ b/libs/libks/src/ks_thread.c @@ -198,6 +198,10 @@ KS_DECLARE(uint8_t) ks_thread_priority(ks_thread_t *thread) { KS_DECLARE(ks_status_t) ks_thread_join(ks_thread_t *thread) { + if (thread->state == KS_THREAD_RUNNING) { + thread->state = KS_THREAD_SHUTDOWN; + } + if (thread->joined) { return KS_STATUS_DUPLICATE_OPERATION; }