-
|
Hey folks! Is it safe to use Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
|
In general, yes, using So for example, if your It's worth noting that there are some cases that don't follow this rule, but still cannot deadlock, however, the rule can be followed in most cases. One case that doesn't follow the rule but is still ok is when the The article Async: What is blocking? discusses this issue a bit in the section on dedicated threads. It is also discussed here. |
Beta Was this translation helpful? Give feedback.
In general, yes, using
block_onat the top level of aspawn_blockingis supported, but if you make use of this feature, there are certain types of behavior that can deadlock (this applies tospawn_blockingin general, whether or not you useblock_oninside it). One rule you can follow which guarantees that you have no deadlocks due to thespawn_blockingpool capacity is that any task running on it (usingblock_onor not) should eventually exit on its own even if all other threads were paused for the full duration of thespawn_blockingcall.So for example, if your
spawn_blockingtask cannot complete until some otherspawn_blockingtask completes, then this can cause a deadlock given enoug…