Replies: 2 comments 2 replies
-
I'm not sure what problem is actually solved by this. You still aren't able to share non- let cell: Cell<i32> = Cell::new(0);
let ex = Executor::new();
let t1 = ex.spawn(async {
cell.set(1);
});
let t2 = ex.spawn(async {
cell.set(2);
}); I guess that if you instantiate the thread-unsafe data in the closure, then it would work better. However I think that use case is pretty niche? If use futures_lite::prelude::*;
let t = ex.spawn(|| {
let cell = Cell::new(0);
let f1 = async {
cell.set(1);
};
let f2 = async {
cell.set(2);
};
f1.or(f2).await;
}); @matklad, I feel like there's something I'm missing here. I'm always looking to improve |
Beta Was this translation helpful? Give feedback.
-
As middle ground, maybe we could have a muti-threaded executor that doesn't do work-stealing, and which uses @matklad 's spawn API delivering a better DX while paying some potential performance loss. Btw, I got some other replies in this tokio discussion thread: tokio-rs/tokio#6346 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I'm posting this idea to many Rust async runtimes discussion threads in order to push for the alternative design of the task spawn API described by @matklad in https://matklad.github.io/2023/12/10/nsfw.html
If you think that this is the right direction for rust to take, I suggest to do the following to arrive at the destination ASAP:
What do you think?
Beta Was this translation helpful? Give feedback.
All reactions