You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The documentation says it will be given its own thread from a special threadpool, and that it's designed for long running blocking code. Is there any reason why we can't use this for CPU heavy tasks or is there something that might make this a bad idea?
The text was updated successfully, but these errors were encountered:
Yes, if you have a CPU-bound task, or any sort of task where polling its future may take a long time, that's the case spawn_blocking is intended to serve.
However, there's a bit of uncertainty around this. The async-std blog had an article talking about how you can just use spawn for everything, and the runtime will dynamically detect if it blocks for a long time, and let it have that thread for its exclusive use. But I'm told that that strategy may be on hold.
The documentation says it will be given its own thread from a special threadpool, and that it's designed for long running blocking code. Is there any reason why we can't use this for CPU heavy tasks or is there something that might make this a bad idea?
The text was updated successfully, but these errors were encountered: