mirror of
https://github.com/home-assistant/developers.home-assistant.git
synced 2025-07-18 23:06:31 +00:00
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:
parent
9b8a18d1b2
commit
9e76c5897a
@ -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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user