]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-10167 auto change state when joining a thread out of the blue
authorAnthony Minessale <anthm@freeswitch.org>
Mon, 27 Mar 2017 20:21:06 +0000 (15:21 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Mon, 27 Mar 2017 20:21:06 +0000 (15:21 -0500)
libs/libks/src/ks_thread.c

index 92c608bd279daf29e1c7c07e3ab4fc6ad73ca586..db1b690fa2d0ac8406a61035a8d4b191a795ae50 100644 (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;
        }