How to pass a `os_workgroup_t` to a child process?

Hi,

This topic is about Workgroups.

I create child processes and I'd like to communicate a os_workgroup_t to my child process so they can join the work group as well.

As far as I understand, the os_workgroup_t value is local to the process.

I've found that one can use os_workgroup_copy_port() and os_workgroup_create_with_port(), but I'm not familiar at all with ports and I wonder what would be the minimal effort to achieve that.

Thank you very much!

Alex

Replies

I am also interested in knowing more about this.

What I have tried so far is

In Process A:

os_workgroup_t wgi = AudioWorkIntervalCreate("myWorkGroup", os_clockid_t::OS_CLOCK_MACH_ABSOLUTE_TIME, nullptr);

if (mach_port_t mp = 0; os_workgroup_copy_port(wgi_, &mp) == 0) {
  // mach_port_t is an unsigned int, here I send value of `mp` to process B.
}

In Process B:

// Received value of `mp` from Process A, then...
const auto handle = os_workgroup_create_with_port("hello", mp);

I always get a nullptr in handle.