Module Metal.SharedEvent

An object used for GPU-GPU or CPU-GPU synchronization, potentially across multiple devices or processes. See MTLSharedEvent.

type t
val sexp_of_t : t -> Sexplib0.Sexp.t
module SharedEventListener : sig ... end

Provides a simple interface for handling MTLSharedEvent notifications. See MTLSharedEventListener.

module SharedEventHandle : sig ... end

A serializable object used to recreate a MTLSharedEvent object in another process. See MTLSharedEventHandle.

val super : t -> Event.t
val on_device : Device.t -> t
val get_device : t -> Device.t
val set_label : t -> string -> unit
val get_label : t -> string
val set_signaled_value : t -> Unsigned.ULLong.t -> unit

Sets the event's signaled value from the CPU.

val get_signaled_value : t -> Unsigned.ULLong.t
val notify_listener : t -> SharedEventListener.t -> value:Unsigned.ULLong.t -> (t -> Unsigned.ULLong.t -> unit) -> unit

Schedules a notification handler block to be called when the event's signaled value reaches or exceeds the specified value. See notifyListener:atValue:block:.

val new_shared_event_handle : t -> SharedEventHandle.t

Creates a serializable handle for this shared event. See newSharedEventHandle.

val wait_until_signaled_value : t -> value:Unsigned.ULLong.t -> timeout_ms:Unsigned.ULLong.t -> bool

Synchronously waits until the signaled value reaches or exceeds the target value, or the timeout elapses. Releases the OCaml runtime lock while waiting. Returns true if the value was reached, false on timeout. See waitUntilSignaledValue:timeoutMS:.