i have a function to launch 2 thread, and i want to block them.
pub fn run(self) {
let get_info_task = self.executor.clone().spawn(async move {
doSomeThing();
});
let send_nonce_task = self.executor.clone().spawn(async move {
doSomeThing();
});
join_all(vec![get_info_task,send_nonce_task]).await;
}
the self.executor
is builded by
let rt = Builder::new()
.core_threads(1)
.threaded_scheduler()
.enable_all()
.build()
.unwrap();
rt.handle().clone()
but if i do like this
513 | | join_all(vec![get_info_task,send_nonce_task]).await;
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ only allowed inside `async` functions and blocks
if i add
#[tokio::main]
async
it will throws out that
can't use runtime within runtime
do everybody know how to block them? because if i don't use join the main thread will break out.
does block_on
helpful???