Protocol

MTLSharedEvent

An object you use to synchronize access to Metal resources across multiple CPUs, GPUs, and processes.

Declaration

@protocol MTLSharedEvent

Overview

The MTLSharedEvent protocol inherits from and adds additional behaviors to MTLEvent. Use shared events only when you need to synchronize changes to resources across multiple Metal device objects, across processes, or between a device object and CPU access to resources. Otherwise, use nonshared events.

Don't implement this protocol yourself; instead, to create a MTLSharedEvent object, call the newSharedEvent method of a MTLDevice object.

To pass this event to another process, first create a handle to the shared event by calling its newSharedEventHandle method. Then, transfer the handle to another process via XPC, and from that process, call the newSharedEventWithHandle: of a MTLDevice object.

For more information, see Synchronizing Events Across Multiple Devices and Encode Synchronization Events Between a GPU and the CPU.

Topics

Synchronizing a Shareable Event

signaledValue

The current signal value for the shareable event.

Required.

- notifyListener:atValue:block:

Schedules a notification handler to be called after the shareable event’s signal value equals or exceeds a given value.

Required.

MTLSharedEventNotificationBlock

A block of code invoked after a shareable event’s signal value equals or exceeds a given value.

Creating a Shared Event Handle

- newSharedEventHandle

Creates a new shareable event handle.

Required.

Relationships

Inherits From

See Also

Events

About Synchronization Events

Synchronize access to resources in your app by signaling events.

Synchronizing Events Within a Single Device

Use nonshareable events to synchronize your app’s work within a single device.

Synchronizing Events Across Multiple Devices

Use shareable events to synchronize your app’s work across multiple devices.

Synchronizing Events Between a GPU and the CPU

Use shareable events to synchronize your app's work between a GPU and the CPU.

Image Filter Graph with Heaps and Events

Demonstrates how to use heaps and events to optimize a multistage image filter.

MTLEvent

An object you use to synchronize access to Metal resources.

MTLSharedEventListener

A listener for shareable event notifications.

MTLSharedEventHandle

An object you use to recreate a shareable event.