Add warning for call async function from a thread (#409)

* Add warning for call async function from a thread

* Update docs/asyncio_working_with_async.md

Co-Authored-By: Aaron Bach <bachya1208@gmail.com>

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
Co-authored-by: Aaron Bach <bachya1208@gmail.com>
This commit is contained in:
Pascal Vizeli 2020-02-18 19:53:13 +01:00 committed by GitHub
parent 9b8a18d1b2
commit 9e76c5897a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -90,6 +90,8 @@ async def async_say_hello(hass, target):
return f"Hello {target}!"
```
**Warning:** be careful with this! If the async function uses executor jobs, it can lead to a deadlock.
## Calling sync functions from async
If you are running inside an async context, it might sometimes be necessary to call a sync function. Do this like this: