Haravikk
Haravikk

Reputation: 3290

What is the Preferred Method for Cross-Process Communication in OS X?

Quite simply I need a basic method for sending broadcast type events between processes owned by different users, so that I can negotiate a simple queueing mechanism (to prevent the processes from attempting to do all of their work at the same time).

Now, the only system I'm aware of for doing this would be via notifyd, or more specifically, by using the various notify functions available in Objective-C (or actually, C++/C?).

However, at lot has changed, and in particular I'm trying to dive back in using Swift, while writing an application that will play nice with the new Mac App Store's required sandboxing scheme. So I'm curious, is communication via notifyd still the preferred mechanism for inter-process communication in OS X, or is there something else I would be better to use?

As I say, my needs are fairly simple; I really just need to be able to let other processes know when a new process starts up, so they can negotiate a simple system for performing their work in a round-robin fashion, without requiring some kind of central process (as that scheme would need elevated permissions to work).

Upvotes: 1

Views: 385

Answers (1)

Jeremy Pope
Jeremy Pope

Reputation: 3352

There are several ways to do this in OS X, a list covers many of them here. I'd say the preferred method depends on what you are trying to accomplish. If you really are just needing to send a notification, then the BSD notification system is a lightweight way to do that.

Upvotes: 2

Related Questions