Name

eglReleaseThread — Release EGL per-thread state

C Specification

EGLBoolean eglReleaseThread( void);  
 

Description

eglReleaseThread returns the EGL to its state at thread initialization, releasing all per-thread state including the error status returned by eglGetError, the currently bound rendering API defined by eglBindAPI, and the current contexts for each supported client API. The overhead of maintaining this state may be objectionable in applications which create and destroy many threads, but only call EGL or client APIs in a few of those threads at any given time.

EGL_TRUE is returned on success, and the following actions are taken:

  • For each client API supported by EGL, if there is a currently bound context, that context is released. This is equivalent to calling eglMakeCurrent with ctx set to EGL_NO_CONTEXT and both draw and read set to EGL_NO_SURFACE (see section 3.7.3).

  • The current rendering API is reset to its value at thread initialization (see eglBindAPI).

  • Any additional implementation-dependent per-thread state maintained by EGL is marked for deletion as soon as possible.

eglReleaseThread may be called in any thread at any time, and may be called more than once in a single thread. The initialization status of EGL (see section 3.2) is not affected by releasing the thread; only per-thread state is affected.

Resources explicitly allocated by calls to EGL, such as contexts, surfaces, and configuration lists, are not affected by eglReleaseThread. Such resources belong not to the thread, but to the EGL implementation as a whole.

Notes

eglReleaseThread is supported only if the EGL version is 1.2 or greater.

Applications may call other EGL routines from a thread following eglReleaseThread, but any such call may reallocate the EGL state previously released. In particular, calling eglGetError immediately following a successful call to eglReleaseThread will return EGL_SUCCESS, but will also result in reallocating per-thread state.

Errors

EGL_FALSE is returned on failure, EGL_TRUE otherwise. There are no defined conditions under which failure will occur. Even if EGL is not initialized on any EGLDisplay, eglReleaseThread should succeed.

However, platform-dependent failures may be signaled through the value returned from eglGetError. Unless the platform-dependent behavior is known, a failed call to eglReleaseThread should be assumed to leave the current rendering API, and the currently bound contexts for each supported client API, in an unknown state.