# How to kill thread?

**URL:** <https://discourse.julialang.org/t/how-to-kill-thread/34236>\
**Category:** New to Julia\
**Tags:** question\
**Created:** [February 6, 2020, 5:25am UTC](https://discourse.julialang.org/t/how-to-kill-thread/34236 "2020-02-06T05:25:10Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![tkf](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tkf/32/17635_2.png) [@tkf](https://discourse.julialang.org/u/tkf)\
**Post date:** [February 6, 2020, 6:59am UTC](https://discourse.julialang.org/t/how-to-kill-thread/34236/7 "2020-02-06T06:59:54Z")

</div>

According to @jameson, `schedule(..., error=true) ` is not the correct way to terminate the task already started and there is no way to safely interrupt a task. [Stop/terminate a (sub)task started with @async - #8 by jameson](https://discourse.julialang.org/t/stop-terminate-a-sub-task-started-with-async/32193/8)

> [@Sijun](#):
>
> I am trying to do the following:
> 
> `Threads.@spawn run(pipeline(`adb shell “logcat -v time | grep onScanResult”`, io))`

First of all, you don’t need to use thread to run I/O concurrently. `@async` is enough. Also, for running external processes concurrently, you don’t even need to use `@async`:

```julia
julia> proc = run(`sleep 60`; wait = false)
Process(`sleep 60`, ProcessRunning)

julia> kill(proc)

julia> proc
Process(`sleep 60`, ProcessSignaled(15))

```

---

_[View the full topic](https://discourse.julialang.org/t/how-to-kill-thread/34236)._
