Stop The XPC Service during execution

Hello.

We have an XPC Helper in our app. It uses for processing of the images. This processing can takes few minutes. And we need to stop it if user push the cancel button. But we couldn't to found solution for stop execution of the XPC Service task immediately. And solution for termination XPC Service too.

Is it possible to stop or terminate XPC process immediately? And what we can to do for it?

Replies

Add another message to your xpc to stop the process.
In your process images method you probably have a loop, in this loop check the state of a "cancelled" variable, and use another method to set this "cancelled" variable to true.