Question about thread.kill

Hello

If I set up a running thread thread1, and call thread1.kill from the main thread:

Does the main thread always wait for thread1’s stack to fully unwind and for thread1 to come to an idle state before continuing?

Or are there some cases where thread1 might continue its cleanup/unwinding simultaneously with the main thread executing beyond the call to .kill?

Tom

I think that the main thread will wait, unless thread1 yields during its death in which case you can’t be so sure.

#pragma disableBackgroundTasks

can help with this, though there are some framework calls that yield internally that can surprise you.

You could send a t.suspend(), wait for suspended status, and send a t.kill()