1<refentry xmlns="http://docbook.org/ns/docbook" version="5.0" xml:base="" xml:id="eglReleaseThread"> 2 <info> 3 <copyright> 4 <year>2003-2014</year> 5 <holder>The Khronos Group Inc.</holder> 6 </copyright> 7 </info> 8 <refmeta> 9 <refentrytitle>eglReleaseThread</refentrytitle> 10 <manvolnum>3G</manvolnum> 11 </refmeta> 12 <refnamediv> 13 <refname>eglReleaseThread</refname> 14 <refpurpose>Release EGL per-thread state</refpurpose> 15 </refnamediv> 16 <refsynopsisdiv><title>C Specification</title> 17 <funcsynopsis> 18 <funcprototype> 19 <funcdef>EGLBoolean <function>eglReleaseThread</function></funcdef> 20 <void/> 21 </funcprototype> 22 </funcsynopsis> 23 </refsynopsisdiv> 24 <refsect1 xml:id="description"><title>Description</title> 25 <para> 26 <function>eglReleaseThread</function> returns the EGL to its 27 state at thread initialization, releasing all per-thread 28 state including the error status returned by 29 <command>eglGetError</command>, the currently bound 30 rendering API defined by <command>eglBindAPI</command>, and 31 the current contexts for each supported client API. The 32 overhead of maintaining this state may be objectionable in 33 applications which create and destroy many threads, but only 34 call EGL or client APIs in a few of those threads at any 35 given time. 36 </para> 37 <para> 38 <constant>EGL_TRUE</constant> is returned on success, and the 39 following actions are taken: 40 </para> 41 <itemizedlist> 42 <listitem> 43 <para> 44 For each client API supported by EGL, if there is a 45 currently bound context, that context is released. 46 This is equivalent to calling 47 <function>eglMakeCurrent</function> with ctx set to 48 <constant>EGL_NO_CONTEXT</constant> and both draw 49 and read set to <constant>EGL_NO_SURFACE</constant> 50 (see section 3.7.3). 51 </para> 52 </listitem> 53 <listitem> 54 <para> 55 The current rendering API is reset to its value at 56 thread initialization (see 57 <command>eglBindAPI</command>). 58 </para> 59 </listitem> 60 <listitem> 61 <para> 62 Any additional implementation-dependent per-thread 63 state maintained by EGL is marked for deletion as 64 soon as possible. 65 </para> 66 </listitem> 67 </itemizedlist> 68 <para> 69 <function>eglReleaseThread</function> may be called in any 70 thread at any time, and may be called more than once in a 71 single thread. The initialization status of EGL (see section 72 3.2) is not affected by releasing the thread; only 73 per-thread state is affected. 74 </para> 75 <para> 76 Resources explicitly allocated by calls to EGL, such as 77 contexts, surfaces, and configuration lists, are not 78 affected by <function>eglReleaseThread</function>. Such 79 resources belong not to the thread, but to the EGL 80 implementation as a whole. 81 </para> 82 </refsect1> 83 <refsect1 xml:id="notes"><title>Notes</title> 84 <para> 85 <function>eglReleaseThread</function> is supported only if the 86 EGL version is 1.2 or greater. 87 </para> 88 <para> 89 Applications may call other EGL routines from a thread 90 following <function>eglReleaseThread</function>, but any 91 such call may reallocate the EGL state previously released. 92 In particular, calling <function>eglGetError</function> 93 immediately following a successful call to 94 <function>eglReleaseThread</function> will return 95 <constant>EGL_SUCCESS</constant>, but will also result in 96 reallocating per-thread state. 97 </para> 98 </refsect1> 99 <refsect1 xml:id="errors"><title>Errors</title> 100 <para> 101 <constant>EGL_FALSE</constant> is returned on failure, 102 <constant>EGL_TRUE</constant> otherwise. There are no 103 defined conditions under which failure will occur. Even if 104 EGL is not initialized on any EGLDisplay, 105 <function>eglReleaseThread</function> should succeed. 106 </para> 107 <para> 108 However, platform-dependent failures may be signaled through 109 the value returned from <function>eglGetError</function>. 110 Unless the platform-dependent behavior is known, a failed 111 call to <function>eglReleaseThread</function> should be 112 assumed to leave the current rendering API, and the 113 currently bound contexts for each supported client API, in 114 an unknown state. 115 </para> 116 </refsect1> 117 <refsect1 xml:id="seealso"><title>See Also</title> 118 <para> 119 <citerefentry><refentrytitle>eglBindAPI</refentrytitle></citerefentry>, 120 <citerefentry><refentrytitle>eglGetError</refentrytitle></citerefentry>, 121 <citerefentry><refentrytitle>eglMakeCurrent</refentrytitle></citerefentry> 122 </para> 123 </refsect1> 124 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="copyright.xml"/> 125</refentry> 126