litert::Event

#include <litert_event.h>

Defines the C++ wrapper for LiteRT events, used for synchronization.

Summary

Inheritance

Inherits from: internal::BaseHandle< LiteRtEvent >

Public types

Type enum

Public static functions

CreateFromEglSyncFence(const Environment & env, LiteRtEglSyncKhr egl_sync)
Creates an Event object from an EGL sync fence.
CreateFromOpenClEvent(const Environment & env, LiteRtClEvent cl_event)
Creates an Event object from an OpenCL event.
CreateFromSyncFenceFd(const Environment & env, int sync_fence_fd, bool owns_fd)
Creates an Event object from a sync fence file descriptor.
CreateManaged(const Environment & env, Type type)
Creates a managed event of a given type.
WrapCObject(const internal::EnvironmentHolder & env, LiteRtEvent event, OwnHandle owned)

Public functions

DupFd()
Expected< int >
Returns a duplicate of the event's sync fence file descriptor.
GetCustomNativeEvent()
Expected< void * >
GetEglSync()
Expected< LiteRtEglSyncKhr >
GetOpenClEvent()
Expected< LiteRtClEvent >
Returns the underlying OpenCL event if the event type is OpenCL.
GetSyncFenceFd()
Expected< int >
IsSignaled()
Expected< bool >
Returns true if the event is signaled.
Signal()
Expected< void >
Signals the event.
Type() const
Type
Returns the underlying event type.
Wait(int64_t timeout_in_ms)
Expected< void >
Waits for the event to be signaled.

Public types

Type

 Type

Public static functions

CreateFromEglSyncFence

Expected< Event > CreateFromEglSyncFence(
  const Environment & env,
  LiteRtEglSyncKhr egl_sync
)

Creates an Event object from an EGL sync fence.

CreateFromOpenClEvent

Expected< Event > CreateFromOpenClEvent(
  const Environment & env,
  LiteRtClEvent cl_event
)

Creates an Event object from an OpenCL event.

CreateFromSyncFenceFd

Expected< Event > CreateFromSyncFenceFd(
  const Environment & env,
  int sync_fence_fd,
  bool owns_fd
)

Creates an Event object from a sync fence file descriptor.

CreateManaged

Expected< Event > CreateManaged(
  const Environment & env,
  Type type
)

Creates a managed event of a given type.

Currently, only LiteRtEventTypeOpenCl is supported.

WrapCObject

Event WrapCObject(
  const internal::EnvironmentHolder & env,
  LiteRtEvent event,
  OwnHandle owned
)

Public functions

DupFd

Expected< int > DupFd()

Returns a duplicate of the event's sync fence file descriptor.

GetCustomNativeEvent

Expected< void * > GetCustomNativeEvent()

GetEglSync

Expected< LiteRtEglSyncKhr > GetEglSync()

GetOpenClEvent

Expected< LiteRtClEvent > GetOpenClEvent()

Returns the underlying OpenCL event if the event type is OpenCL.

GetSyncFenceFd

Expected< int > GetSyncFenceFd()

IsSignaled

Expected< bool > IsSignaled()

Returns true if the event is signaled.

Signal

Expected< void > Signal()

Signals the event.

Type

Type Type() const 

Returns the underlying event type.

Wait

Expected< void > Wait(
  int64_t timeout_in_ms
)

Waits for the event to be signaled.

Details
Parameters
timeout_in_ms
The timeout in milliseconds. A value of -1 indicates an indefinite wait.