Closed Bug 1553691 Opened 6 years ago Closed 1 year ago

CrossProcessSemaphore is unimplemented on OSX

Categories

(Core :: IPC, defect, P3)

Unspecified
macOS
defect

Tracking

()

RESOLVED FIXED
119 Branch
Tracking Status
firefox119 --- fixed

People

(Reporter: handyman, Assigned: lsalzman)

References

(Blocks 3 open bugs)

Details

(Whiteboard: [sp3])

Attachments

(1 file)

CrossProcessSemaphore is currently used in TextureClient's TextureReadLock and in Bob Owen's upcoming Canvas 2D work in bug 1464032. Right now, the mac implementation uses CrossProcessSemaphore_unimplemented. POSIX semaphores are unimplemented on mac and (I think) its SYS V semaphores don't support timed shared semaphores either. It looks like Mach has a solution and :jld mentioned on IRC that the Mojo library must do something (looks like Mach to me).

Mojo has the ability to attach Mach ports to messages, which would allow using Mach semaphores; the closest thing we have for that is the parallel IPC system buried in SharedMemoryBasic_mach.mm, or the (very likely bit-rotted) patches in bug 1480205 which add a MachEndpoint usable in a similar way to IPC's Endpoint<T>.

Mojo also has data pipes, for streaming data between two processes in shared memory, which is what at least some of the semaphore use cases are trying to do; for signaling full/empty conditions they seem to just use Mojo's node/channel network (the same thing that message pipes are multiplexed onto) rather than an OS-level semaphore.

Priority: -- → P3
See Also: → 1613397
Severity: normal → S3

Unnamed POSIX semaphores are not supported on macOS, nor is timed wait supported on
named POSIX semaphores. SysV semaphores have similar limitations.

Mach semaphores are one of the only clean ways to create unnamed, shareable semaphores
on macOS. As of bug 1734735, we now can transparently send the mach ports across to
other processes without much added code, overall making this implementation of Mach
semaphores fairly easy.

Assignee: nobody → lsalzman
Status: NEW → ASSIGNED

The following patch is waiting for review from a reviewer who resigned from the review:

ID Title Author Reviewer Status
D188429 Bug 1553691 - Implement CrossProcessSemaphore on macOS using Mach semaphores. r?bobowen lsalzman bobowen: Resigned from review

:lsalzman, could you please find another reviewer?

For more information, please visit BugBot documentation.

Flags: needinfo?(lsalzman)
Flags: needinfo?(lsalzman)
Blocks: speedometer3
Pushed by lsalzman@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/7f4d1fc6e2b9 Implement CrossProcessSemaphore on macOS using Mach semaphores. r=nika
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 119 Branch
Whiteboard: [sp3]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: