Marks all related classes as experimental as the shape of this is likely to continue to evolve and it's rather plausible there are lurking issues.
Overview of how things are now structured:
SharedRawMemory: This is basically just a mapped UnsafeMutableRawPointer, it's actually rather simple
SharedMemory: This wraps the above and makes it typed, it's also pretty straightforward
SharedSemaphore: This is a complete reimplementation of a semaphore, now publicly exposed. It turns out only POSIX semaphores work properly across process in macOS (including sandbox support). This has a lot of complexity to it.
SharedTrivial: This is now a box, not a property wrapper as property wrappers don't play nicely with the fact that mutations can fail, which is always an option for cross-process operations. This makes use of SharedSemaphore and SharedMemory so it's simpler than it used to be.
Note: The ergonomics of using SharedTrivial when there's sandboxing isn't great, will look into further improvements to this as a follow up PR. Loose thoughts are a static property for the default app group to use which can be set on SharedSemaphore.
Marks all related classes as experimental as the shape of this is likely to continue to evolve and it's rather plausible there are lurking issues.
Overview of how things are now structured:
SharedRawMemory
: This is basically just a mappedUnsafeMutableRawPointer
, it's actually rather simpleSharedMemory
: This wraps the above and makes it typed, it's also pretty straightforwardSharedSemaphore
: This is a complete reimplementation of a semaphore, now publicly exposed. It turns out only POSIX semaphores work properly across process in macOS (including sandbox support). This has a lot of complexity to it.SharedTrivial
: This is now a box, not a property wrapper as property wrappers don't play nicely with the fact that mutations can fail, which is always an option for cross-process operations. This makes use ofSharedSemaphore
andSharedMemory
so it's simpler than it used to be.Note: The ergonomics of using
SharedTrivial
when there's sandboxing isn't great, will look into further improvements to this as a follow up PR. Loose thoughts are a static property for the default app group to use which can be set onSharedSemaphore
.