0
votes

I want to run multiple concurrent logical operations within an XPC service. Thing is, though, XPC services are singletons — either they’re running, or they’re not. Can I use NSThread, dispatch queues, or similar to simulate this?

The application that will be consuming this XPC service is a sandboxed user app that uses XPC services to workaround the limitations inherent in sandboxed fork/exec.

1
Your service is just another process. Did you try using a thread or dispatch queue? Did you actually encounter any problems? - Kurt Revis
@KurtRevis: Honestly, I didn’t try it yet. I was wondering if it was theoretically possible. Your comment seems to state that it is, so I’ll try it. - wjk

1 Answers

0
votes

If you're talking about sandboxed XPC, then yes, you can multi-thread, BUT, launchd keeps a close eye on you and throttles it a lot depending on the load at the time.

If there's too much activity, it could be inherently terminated as a "Misuse of API" violation (which launchd likes to do to XPC a lot).

If you're planning on not being sandboxed, and working with mach services, then you shouldn't have an issue.

What sort of service/server/helper/whatever are you looking at?

Is it designed to be in userspace? i.e. when a user opens the apps in which its contained? Or is it part of daemons and other deeper services?