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
I noticed that the function spawn_blocking and every function that relies on it (for example, all the file related operations) does not allow choosing an executor. From the documentation:
The task will be spawned onto a thread pool specifically dedicated to blocking tasks. This is useful to prevent long-running synchronous operations from blocking the main futures executor.
I was very surprised to read this line in the documentation. My usual experience with rust libraries is that everything is zero cost abstraction, or at least attempts to be as much as possible. Creating an implicit executor seems to be going in the other direction.
For all my testing I am using a deterministic executor that allows to detect deadlocks and simulate the passage of time.
An example, If I choose to use a function like async_std::fs::remove_dir anywhere in my code, I will not be able to use my deterministic executor to test the code. Because now, instead of having one test executor that I control, I also get an additional implicit executor from inside async-std that is out of my control.
Is there any workaround if I want to be able to use my executor instead of the implicit one provided by async-std?
EDIT: This issue seems to be a problem that repeats in other async frameworks. See also:
@realcr it sounds like what you want is perhaps a global hook for executors. Making async-std deterministic has not been part of the design so far; we've focused on making it accessible, performant, and complete.
However I'm sympathetic to your use case, and see how that could be valuable. Thanks for raising this, we'll keep this issue open!
Hi, thank you for your work on async-std!
I noticed that the function
spawn_blocking
and every function that relies on it (for example, all the file related operations) does not allow choosing an executor. From the documentation:I was very surprised to read this line in the documentation. My usual experience with rust libraries is that everything is zero cost abstraction, or at least attempts to be as much as possible. Creating an implicit executor seems to be going in the other direction.
For all my testing I am using a deterministic executor that allows to detect deadlocks and simulate the passage of time.
An example, If I choose to use a function like
async_std::fs::remove_dir
anywhere in my code, I will not be able to use my deterministic executor to test the code. Because now, instead of having one test executor that I control, I also get an additional implicit executor from insideasync-std
that is out of my control.Is there any workaround if I want to be able to use my executor instead of the implicit one provided by
async-std
?EDIT: This issue seems to be a problem that repeats in other async frameworks. See also:
Possibly related to issue: #79
The text was updated successfully, but these errors were encountered: