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.

See Also

eglBindAPI, eglGetError, eglMakeCurrent

Copyright © 2003-2014 The Khronos Group Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and/or associated documentation files (the "Materials"), to deal in the Materials without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Materials, and to permit persons to whom the Materials are furnished to do so, subject to the condition that this copyright notice and permission notice shall be included in all copies or substantial portions of the Materials.