I’d like to stop immediately a method if I press cancel in the “processing” animation screen. I’m using Async call through delegates. Is it possible to stop immediately the execution of the method through delegates?
Thanks 🙂
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No – at least, not cleanly. (I don’t include
Thread.Abortas “clean”.) What you should do is have a mechanism to tell the delegate that you’re trying to cancel it. Your delegate would then need to occasionally check that cancellation flag and react accordingly.Parallel Extensions has cancellation built into it all over the place (and in particular cancellation tokens to allow only appropriate pieces of code to cancel the task). It’s all still co-operative though, as far as I’m aware. Forced cancellation will always run the risk of corrupting state.