I have an application with 2 components: a desktop application that users interact with, and a background process that can be enabled from the desktop application. Once the background process is enabled, it will run as a user launch agent independently of the desktop app.
However, what I'm wondering is what to do when the user disables the background process. At this point I want to stop the background process but I'm not sure what the best approach is. The 3 options that I see are:
- Use the 'kill' command.
- Direct, but not reliable and just seems somewhat "wrong".
- Use an NSMachPort to send an exit request from the desktop app to the background process.
- This is the best approach I've thought of but I've run into an implementation problem (I'll be posting this in a separate query) and I'd like to be sure that the approach is right before going much further.
- Something else???
Thank you in advance for any help/insight that you can offer.