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 would love to use this little function like I have been using tokio::runtime::Runtime::new().unwrap().block_on, which will return the result of the future so that I can easily move on with the value returned.
I am not sure how to achieve that with executor. I've been declaring a variable outside of the future closure and trying to mutate it from within the closure, so that I can use the value once the future has completed. It's not working out so well. What can be done?
The text was updated successfully, but these errors were encountered:
Hi, I think there are several features, that don't let as use something stuff like that. At first, (and at general) executor can work at no_std context, so we cant use blocking sleep features, like std::thread::sleep, std::sync::Mutex(with thread sleep feature. Note, that this executor use spin::mutex mutex, that has some flaws, bot work at no_std context), std::sync::Condvar and etc. So, second, if this features will be realized, it will block current thread(with 100% CPU core load) until Task done. At std context I suggest using local variables and closures, like you try before, but wrapped at Arc::Mutex<<T>> type. Otherwise we should found something like that or use(or create) other synchronization primitives like implemented at this embedded executor https://github.com/embassy-rs/embassy/tree/main/embassy-sync
I would love to use this little function like I have been using
tokio::runtime::Runtime::new().unwrap().block_on
, which will return the result of the future so that I can easily move on with the value returned.I am not sure how to achieve that with
executor
. I've been declaring a variable outside of the future closure and trying to mutate it from within the closure, so that I can use the value once the future has completed. It's not working out so well. What can be done?The text was updated successfully, but these errors were encountered: