How to kill thread?

Thank you for your reply. I will give it a go as you suggest.

Actually I needed to be more specific. I am trying to do the following:

Threads.@spawn run(pipeline(`adb shell "logcat -v time | grep onScanResult"`, io))

Initially I discovered that run() was a blocking call and I could’t do anything after that. So I let a separate thread call run().

I am naively expecting that if I could somehow kill the thread, then the process launched by that thread may also be killed…but this is a wrong understanding?