# Inconsistency between @async warning and its usage in documentation

**URL:** <https://discourse.julialang.org/t/inconsistency-between-async-warning-and-its-usage-in-documentation/100978>\
**Category:** General Usage\
**Tags:** question, documentation\
**Created:** [June 29, 2023, 1:57pm UTC](https://discourse.julialang.org/t/inconsistency-between-async-warning-and-its-usage-in-documentation/100978 "2023-06-29T13:57:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![algunion](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/algunion/32/51630_2.png) [@algunion](https://discourse.julialang.org/u/algunion)\
**Post date:** [June 29, 2023, 1:57pm UTC](https://discourse.julialang.org/t/inconsistency-between-async-warning-and-its-usage-in-documentation/100978/1 "2023-06-29T13:57:42Z")

</div>

Recently I was answering an `@async` related question, and I remembered a documentation warning against `@async` usage. After checking that out, it was still [there](https://docs.julialang.org/en/v1/base/parallel/#Base.@async):

> It is strongly encouraged to favor `Threads.@spawn` over `@async` always **even when no parallelism is required** especially in publicly distributed libraries. This is because a use of `@async` disables the migration of the _parent_ task across worker threads in the current implementation of Julia. Thus, seemingly innocent use of `@async` in a library function can have a large impact on the performance of very different parts of user applications.

However, when looking, for example, at the [Channels](https://docs.julialang.org/en/v1/manual/asynchronous-programming/#Communicating-with-Channels) we see `@async` is being used when instructing how people should use Channels.

So, either the warning is outdated, or the usage of `@async` in other places of the documentation is somehow problematic (I don’t think it is fair to have people go and check if using `@async` is good practice - since it is already used in the documentation as a proper way to do things - in this case Channels).

So, which one should we change?

---

<div class="post-metadata">

**Author:** ![phantom](https://avatars.discourse-cdn.com/v4/letter/p/e0b2c6/32.png) [@phantom](https://discourse.julialang.org/u/phantom)\
**Post date:** [June 30, 2023, 9:18am UTC](https://discourse.julialang.org/t/inconsistency-between-async-warning-and-its-usage-in-documentation/100978/2 "2023-06-30T09:18:51Z")

</div>

I’m not sure how related this is but I also came across the following in the [docs](https://docs.julialang.org/en/v1/manual/asynchronous-programming/#More-on-Channels)

`Instead of `errormonitor(t)`, a more robust solution may be use use `bind(results, t)`, as that will not only log any unexpected failures, but also force the associated resources to close and propagate the exception everywhere.`

As with @async, the example in the section uses `errormonitor(@async dowork())` whereas I guess the approach being recommended would actually be `bind(channel, @spawn dowork())` ?

---

<div class="post-metadata">

**Author:** ![algunion](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/algunion/32/51630_2.png) [@algunion](https://discourse.julialang.org/u/algunion)\
**Post date:** [June 30, 2023, 9:37am UTC](https://discourse.julialang.org/t/inconsistency-between-async-warning-and-its-usage-in-documentation/100978/3 "2023-06-30T09:37:29Z")

</div>

I also opened an issue [here](https://github.com/JuliaLang/julia/issues/50356).

It seems it is known that the manual is outdated.
