Name

eglClientWaitSync — Wait in the client for a sync object to be signalled

C Specification

EGLint eglClientWaitSync( (EGLDisplay display,
  EGLSync sync,
  EGLint flags,
  EGLTime timeout);
 

Parameters

display

Specifies the EGL display connection.

sync

Specifies the sync object to wait on.

flags

Specifies flags controlling wait behavior.

timeout

Specifies wait timeout interval.

Description

eglClientWaitSync blocks the calling thread until the specified sync object sync is signaled, or until timeout nanoseconds have passed.

More than one eglClientWaitSync may be outstanding on the same sync at any given time. When there are multiple threads blocked on the same sync and the sync object is signaled, all such threads are released, but the order in which they are released is not defined.

If the value of timeout is zero, then eglClientWaitSync simply tests the current status of sync. If the value of timeout is the special value EGL_FOREVER, then eglClientWaitSync does not time out. For all other values, timeout is adjusted to the closest value allowed by the implementation-dependent timeout accuracy, which may be substantially longer than one nanosecond.

eglClientWaitSync returns one of three status values describing the reason for returning. A return value of EGL_TIMEOUT_EXPIRED indicates that the specified timeout period expired before sync was signaled, or if timeout is zero, indicates that sync is not signaled. A return value of EGL_CONDITION_SATISFIED indicates that sync was signaled before the timeout expired, which includes the case when sync was already signaled when eglClientWaitSync was called. If an error occurs then an error is generated and EGL_FALSE is returned.

If the sync object being blocked upon will not be signaled in finite time (for example, by an associated fence command issued previously, but not yet flushed to the graphics pipeline), then eglClientWaitSync may wait forever. To help prevent this behavior, if the EGL_SYNC_FLUSH_COMMANDS_BIT bit is set in flags, and sync is unsignaled when eglClientWaitSync is called, then the equivalent of Flush() will be performed for the current API context (i.e., the context returned by eglGetCurrentContext) before blocking on sync. If no context is current for the bound API, the EGL_SYNC_FLUSH_COMMANDS_BIT bit is ignored.

Note: the simple Flush behavior defined by EGL_SYNC_FLUSH_COMMANDS_BIT will not help when waiting for a fence command issued in a different context's command stream. Applications which block on a fence sync object must take additional steps to ensure that the context from which the associated fence command was issued has flushed that command to the graphics pipeline.

Errors

eglClientWaitSync returns EGL_FALSE on failure.

If sync is not a valid sync object for display, an EGL_BAD_PARAMETER error is generated.

If display does not match the EGLDisplay passed to eglCreateSync when sync was created, the behaviour is undefined.

Notes

eglClientWaitSync is available only if the EGL version is 1.5 or greater.

See Also

eglCreateSync, eglGetCurrentContext, eglWaitSync, glFinish, vgFinish