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
hi im new to rust and stumbled across this library. currently i try to do a simple music application and have a music player running inside a task. but the problem is that i now cant directly stop the task. i tried it with JoinHandler.cancel().await but that just waits till the task is finished. is there a way to directly kill it? thanks :D
The text was updated successfully, but these errors were encountered:
cancel() waits for the task to reappear in the executor's queue for the last time before it dies. For async tasks, this should be instant. However, if it isn't instant, what I'd suspect is that your task contains a blocking call.
I agree with the poster that async-std is missing this capability. tokio has a synchronous JoinHandle::abort and smol has the equivalent synchronous cancel-on-drop. async-std currently has absolutely no way of synchronously cancel a task. This is unfortunate since the underlying smol already has a readily available Task::set_canceled(&mut self).
The only thing left is just to introduce a new method JoinHandle::whatever_name_for_sync_cancel(self).
hi im new to rust and stumbled across this library. currently i try to do a simple music application and have a music player running inside a task. but the problem is that i now cant directly stop the task. i tried it with JoinHandler.cancel().await but that just waits till the task is finished. is there a way to directly kill it? thanks :D
The text was updated successfully, but these errors were encountered: