FS-10167 auto change state when joining a thread out of the blue

This commit is contained in:
Anthony Minessale 2017-03-27 15:21:06 -05:00
parent 82e510a54d
commit aa526a5363
1 changed files with 4 additions and 0 deletions

View File

@ -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;
}