# Ending @async task externally

**URL:** <https://discourse.julialang.org/t/ending-async-task-externally/60693>\
**Category:** General Usage\
**Created:** [May 7, 2021, 5:48am UTC](https://discourse.julialang.org/t/ending-async-task-externally/60693 "2021-05-07T05:48:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ligert123](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ligert123/32/24682_2.png) [@ligert123](https://discourse.julialang.org/u/ligert123)\
**Post date:** [May 7, 2021, 5:48am UTC](https://discourse.julialang.org/t/ending-async-task-externally/60693/1 "2021-05-07T05:48:41Z")

</div>

Hello, does anyone know how to close an async task from within another thread? ive been trying to do it using methods like an endless loop with a bool array that is passed in externally but that doesnt seem to work.  
Any ideas?

---

<div class="post-metadata">

**Author:** ![jling](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jling/32/212909_2.png) [@jling](https://discourse.julialang.org/u/jling)\
**Post date:** [May 7, 2021, 6:19am UTC](https://discourse.julialang.org/t/ending-async-task-externally/60693/2 "2021-05-07T06:19:04Z")

</div>

create a `Channel`, then in the body of your task (presumably, there’s a loop of some sorts), check that channel & abort the task if sees kill “instruction” (could just be a Bool) in the channel.
