Sophie

Sophie

distrib > Mageia > 5 > x86_64 > by-pkgid > 7281b619e6b612f5388cfad6b0e56530 > files > 122

sdl2-docs-2.0.3-4.mga5.noarch.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.8"/>
<title>My Project: SDL_thread.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">My Project
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.8 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Macros</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Pages</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#typedef-members">Typedefs</a> &#124;
<a href="#enum-members">Enumerations</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">SDL_thread.h File Reference</div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><code>#include &quot;<a class="el" href="SDL__stdinc_8h_source.html">SDL_stdinc.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="SDL__error_8h_source.html">SDL_error.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="SDL__atomic_8h_source.html">SDL_atomic.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="SDL__mutex_8h_source.html">SDL_mutex.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="begin__code_8h_source.html">begin_code.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="close__code_8h_source.html">close_code.h</a>&quot;</code><br />
</div>
<p><a href="SDL__thread_8h_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a>
Typedefs</h2></td></tr>
<tr class="memitem:a97cd1dc60cea74b74273affb1a974db5"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a97cd1dc60cea74b74273affb1a974db5"></a>
typedef struct SDL_Thread&#160;</td><td class="memItemRight" valign="bottom"><b>SDL_Thread</b></td></tr>
<tr class="separator:a97cd1dc60cea74b74273affb1a974db5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac4db699531ce9f18f5a8547aa988b88e"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ac4db699531ce9f18f5a8547aa988b88e"></a>
typedef unsigned long&#160;</td><td class="memItemRight" valign="bottom"><b>SDL_threadID</b></td></tr>
<tr class="separator:ac4db699531ce9f18f5a8547aa988b88e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a07ce005c35ad6ac377d6124db7296026"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a07ce005c35ad6ac377d6124db7296026"></a>
typedef unsigned <a class="el" href="SDL__thread_8h.html#a6a64f9be4433e4de6e2f2f548cf3c08e">int</a>&#160;</td><td class="memItemRight" valign="bottom"><b>SDL_TLSID</b></td></tr>
<tr class="separator:a07ce005c35ad6ac377d6124db7296026"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="enum-members"></a>
Enumerations</h2></td></tr>
<tr class="memitem:acce8dea56f6b307fadd2949b64e3ebda"><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="SDL__thread_8h.html#acce8dea56f6b307fadd2949b64e3ebda">SDL_ThreadPriority</a> { <b>SDL_THREAD_PRIORITY_LOW</b>, 
<b>SDL_THREAD_PRIORITY_NORMAL</b>, 
<b>SDL_THREAD_PRIORITY_HIGH</b>
 }</td></tr>
<tr class="separator:acce8dea56f6b307fadd2949b64e3ebda"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a6a64f9be4433e4de6e2f2f548cf3c08e"><td class="memItemLeft" align="right" valign="top">typedef&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="SDL__thread_8h.html#a6a64f9be4433e4de6e2f2f548cf3c08e">int</a> (SDLCALL *SDL_ThreadFunction)(<a class="el" href="SDL__audio_8h.html#a52835ae37c4bb905b903cbaf5d04b05f">void</a> *data)</td></tr>
<tr class="separator:a6a64f9be4433e4de6e2f2f548cf3c08e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aca3013d4f50e918b17d2721b37e59082"><td class="memItemLeft" align="right" valign="top">DECLSPEC SDL_Thread *SDLCALL&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="SDL__thread_8h.html#aca3013d4f50e918b17d2721b37e59082">SDL_CreateThread</a> (SDL_ThreadFunction fn, const char *name, <a class="el" href="SDL__audio_8h.html#a52835ae37c4bb905b903cbaf5d04b05f">void</a> *data)</td></tr>
<tr class="separator:aca3013d4f50e918b17d2721b37e59082"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abe2ffa508d85379b355673d557e74d9f"><td class="memItemLeft" align="right" valign="top">DECLSPEC const char *SDLCALL&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="SDL__thread_8h.html#abe2ffa508d85379b355673d557e74d9f">SDL_GetThreadName</a> (SDL_Thread *thread)</td></tr>
<tr class="separator:abe2ffa508d85379b355673d557e74d9f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a341933eef1470789de20b05c1392b9ae"><td class="memItemLeft" align="right" valign="top">DECLSPEC SDL_threadID SDLCALL&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="SDL__thread_8h.html#a341933eef1470789de20b05c1392b9ae">SDL_ThreadID</a> (<a class="el" href="SDL__audio_8h.html#a52835ae37c4bb905b903cbaf5d04b05f">void</a>)</td></tr>
<tr class="separator:a341933eef1470789de20b05c1392b9ae"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0bf5d93ed5cb25ea59307472c62c66db"><td class="memItemLeft" align="right" valign="top">DECLSPEC SDL_threadID SDLCALL&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="SDL__thread_8h.html#a0bf5d93ed5cb25ea59307472c62c66db">SDL_GetThreadID</a> (SDL_Thread *thread)</td></tr>
<tr class="separator:a0bf5d93ed5cb25ea59307472c62c66db"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:adf4da9c0e6a6833bef9741344b09699d"><td class="memItemLeft" align="right" valign="top">DECLSPEC <a class="el" href="SDL__thread_8h.html#a6a64f9be4433e4de6e2f2f548cf3c08e">int</a> SDLCALL&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="SDL__thread_8h.html#adf4da9c0e6a6833bef9741344b09699d">SDL_SetThreadPriority</a> (<a class="el" href="SDL__thread_8h.html#acce8dea56f6b307fadd2949b64e3ebda">SDL_ThreadPriority</a> priority)</td></tr>
<tr class="separator:adf4da9c0e6a6833bef9741344b09699d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac96743626ed21d2cdb0868a23cca9705"><td class="memItemLeft" align="right" valign="top">DECLSPEC <a class="el" href="SDL__audio_8h.html#a52835ae37c4bb905b903cbaf5d04b05f">void</a> SDLCALL&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="SDL__thread_8h.html#ac96743626ed21d2cdb0868a23cca9705">SDL_WaitThread</a> (SDL_Thread *thread, <a class="el" href="SDL__thread_8h.html#a6a64f9be4433e4de6e2f2f548cf3c08e">int</a> *status)</td></tr>
<tr class="separator:ac96743626ed21d2cdb0868a23cca9705"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af90602c51ef5a62f26ed9931af484906"><td class="memItemLeft" align="right" valign="top">DECLSPEC <a class="el" href="SDL__audio_8h.html#a52835ae37c4bb905b903cbaf5d04b05f">void</a> SDLCALL&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="SDL__thread_8h.html#af90602c51ef5a62f26ed9931af484906">SDL_DetachThread</a> (SDL_Thread *thread)</td></tr>
<tr class="separator:af90602c51ef5a62f26ed9931af484906"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac7ed1ec8dec5b902da25b60da2b728fa"><td class="memItemLeft" align="right" valign="top">DECLSPEC SDL_TLSID SDLCALL&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="SDL__thread_8h.html#ac7ed1ec8dec5b902da25b60da2b728fa">SDL_TLSCreate</a> (<a class="el" href="SDL__audio_8h.html#a52835ae37c4bb905b903cbaf5d04b05f">void</a>)</td></tr>
<tr class="memdesc:ac7ed1ec8dec5b902da25b60da2b728fa"><td class="mdescLeft">&#160;</td><td class="mdescRight">Create an identifier that is globally visible to all threads but refers to data that is thread-specific.  <a href="#ac7ed1ec8dec5b902da25b60da2b728fa">More...</a><br /></td></tr>
<tr class="separator:ac7ed1ec8dec5b902da25b60da2b728fa"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab519f8d89ea808f32fc139071e6207bb"><td class="memItemLeft" align="right" valign="top">DECLSPEC <a class="el" href="SDL__audio_8h.html#a52835ae37c4bb905b903cbaf5d04b05f">void</a> *SDLCALL&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="SDL__thread_8h.html#ab519f8d89ea808f32fc139071e6207bb">SDL_TLSGet</a> (SDL_TLSID id)</td></tr>
<tr class="memdesc:ab519f8d89ea808f32fc139071e6207bb"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the value associated with a thread local storage ID for the current thread.  <a href="#ab519f8d89ea808f32fc139071e6207bb">More...</a><br /></td></tr>
<tr class="separator:ab519f8d89ea808f32fc139071e6207bb"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a73a9414493c106d9cb05d1a53d3412fc"><td class="memItemLeft" align="right" valign="top">DECLSPEC <a class="el" href="SDL__thread_8h.html#a6a64f9be4433e4de6e2f2f548cf3c08e">int</a> SDLCALL&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="SDL__thread_8h.html#a73a9414493c106d9cb05d1a53d3412fc">SDL_TLSSet</a> (SDL_TLSID id, const <a class="el" href="SDL__audio_8h.html#a52835ae37c4bb905b903cbaf5d04b05f">void</a> *value, <a class="el" href="SDL__audio_8h.html#a52835ae37c4bb905b903cbaf5d04b05f">void</a>(*destructor)(<a class="el" href="SDL__audio_8h.html#a52835ae37c4bb905b903cbaf5d04b05f">void</a> *))</td></tr>
<tr class="memdesc:a73a9414493c106d9cb05d1a53d3412fc"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set the value associated with a thread local storage ID for the current thread.  <a href="#a73a9414493c106d9cb05d1a53d3412fc">More...</a><br /></td></tr>
<tr class="separator:a73a9414493c106d9cb05d1a53d3412fc"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Header for the SDL thread management routines. </p>
</div><h2 class="groupheader">Enumeration Type Documentation</h2>
<a class="anchor" id="acce8dea56f6b307fadd2949b64e3ebda"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">enum <a class="el" href="SDL__thread_8h.html#acce8dea56f6b307fadd2949b64e3ebda">SDL_ThreadPriority</a></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>The SDL thread priority.</p>
<dl class="section note"><dt>Note</dt><dd>On many systems you require special privileges to set high priority. </dd></dl>

</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="a6a64f9be4433e4de6e2f2f548cf3c08e"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">typedef int </td>
          <td>(</td>
          <td class="paramtype">SDLCALL *&#160;</td>
          <td class="paramname"><em>SDL_ThreadFunction</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>The function passed to <a class="el" href="SDL__thread_8h.html#aca3013d4f50e918b17d2721b37e59082">SDL_CreateThread()</a>. It is passed a void* user context parameter and returns an int. </p>

</div>
</div>
<a class="anchor" id="aca3013d4f50e918b17d2721b37e59082"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">DECLSPEC SDL_Thread* SDLCALL SDL_CreateThread </td>
          <td>(</td>
          <td class="paramtype">SDL_ThreadFunction&#160;</td>
          <td class="paramname"><em>fn</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>name</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="SDL__audio_8h.html#a52835ae37c4bb905b903cbaf5d04b05f">void</a> *&#160;</td>
          <td class="paramname"><em>data</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Create a thread.</p>
<p>Thread naming is a little complicated: Most systems have very small limits for the string length (Haiku has 32 bytes, Linux currently has 16, Visual C++ 6.0 has nine!), and possibly other arbitrary rules. You'll have to see what happens with your system's debugger. The name should be UTF-8 (but using the naming limits of C identifiers is a better bet). There are no requirements for thread naming conventions, so long as the string is null-terminated UTF-8, but these guidelines are helpful in choosing a name:</p>
<p><a href="http://stackoverflow.com/questions/149932/naming-conventions-for-threads">http://stackoverflow.com/questions/149932/naming-conventions-for-threads</a></p>
<p>If a system imposes requirements, SDL will try to munge the string for it (truncate, etc), but the original string contents will be available from <a class="el" href="SDL__thread_8h.html#abe2ffa508d85379b355673d557e74d9f">SDL_GetThreadName()</a>. </p>

</div>
</div>
<a class="anchor" id="af90602c51ef5a62f26ed9931af484906"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">DECLSPEC <a class="el" href="SDL__audio_8h.html#a52835ae37c4bb905b903cbaf5d04b05f">void</a> SDLCALL SDL_DetachThread </td>
          <td>(</td>
          <td class="paramtype">SDL_Thread *&#160;</td>
          <td class="paramname"><em>thread</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>A thread may be "detached" to signify that it should not remain until another thread has called <a class="el" href="SDL__thread_8h.html#ac96743626ed21d2cdb0868a23cca9705">SDL_WaitThread()</a> on it. Detaching a thread is useful for long-running threads that nothing needs to synchronize with or further manage. When a detached thread is done, it simply goes away.</p>
<p>There is no way to recover the return code of a detached thread. If you need this, don't detach the thread and instead use <a class="el" href="SDL__thread_8h.html#ac96743626ed21d2cdb0868a23cca9705">SDL_WaitThread()</a>.</p>
<p>Once a thread is detached, you should usually assume the SDL_Thread isn't safe to reference again, as it will become invalid immediately upon the detached thread's exit, instead of remaining until someone has called <a class="el" href="SDL__thread_8h.html#ac96743626ed21d2cdb0868a23cca9705">SDL_WaitThread()</a> to finally clean it up. As such, don't detach the same thread more than once.</p>
<p>If a thread has already exited when passed to <a class="el" href="SDL__thread_8h.html#af90602c51ef5a62f26ed9931af484906">SDL_DetachThread()</a>, it will stop waiting for a call to <a class="el" href="SDL__thread_8h.html#ac96743626ed21d2cdb0868a23cca9705">SDL_WaitThread()</a> and clean up immediately. It is not safe to detach a thread that might be used with <a class="el" href="SDL__thread_8h.html#ac96743626ed21d2cdb0868a23cca9705">SDL_WaitThread()</a>.</p>
<p>You may not call <a class="el" href="SDL__thread_8h.html#ac96743626ed21d2cdb0868a23cca9705">SDL_WaitThread()</a> on a thread that has been detached. Use either that function or this one, but not both, or behavior is undefined.</p>
<p>It is safe to pass NULL to this function; it is a no-op. </p>

</div>
</div>
<a class="anchor" id="a0bf5d93ed5cb25ea59307472c62c66db"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">DECLSPEC SDL_threadID SDLCALL SDL_GetThreadID </td>
          <td>(</td>
          <td class="paramtype">SDL_Thread *&#160;</td>
          <td class="paramname"><em>thread</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Get the thread identifier for the specified thread.</p>
<p>Equivalent to <a class="el" href="SDL__thread_8h.html#a341933eef1470789de20b05c1392b9ae">SDL_ThreadID()</a> if the specified thread is NULL. </p>

</div>
</div>
<a class="anchor" id="abe2ffa508d85379b355673d557e74d9f"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">DECLSPEC const char* SDLCALL SDL_GetThreadName </td>
          <td>(</td>
          <td class="paramtype">SDL_Thread *&#160;</td>
          <td class="paramname"><em>thread</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Get the thread name, as it was specified in <a class="el" href="SDL__thread_8h.html#aca3013d4f50e918b17d2721b37e59082">SDL_CreateThread()</a>. This function returns a pointer to a UTF-8 string that names the specified thread, or NULL if it doesn't have a name. This is internal memory, not to be free()'d by the caller, and remains valid until the specified thread is cleaned up by <a class="el" href="SDL__thread_8h.html#ac96743626ed21d2cdb0868a23cca9705">SDL_WaitThread()</a>. </p>

</div>
</div>
<a class="anchor" id="adf4da9c0e6a6833bef9741344b09699d"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">DECLSPEC <a class="el" href="SDL__thread_8h.html#a6a64f9be4433e4de6e2f2f548cf3c08e">int</a> SDLCALL SDL_SetThreadPriority </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="SDL__thread_8h.html#acce8dea56f6b307fadd2949b64e3ebda">SDL_ThreadPriority</a>&#160;</td>
          <td class="paramname"><em>priority</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Set the priority for the current thread </p>

</div>
</div>
<a class="anchor" id="a341933eef1470789de20b05c1392b9ae"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">DECLSPEC SDL_threadID SDLCALL SDL_ThreadID </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="SDL__audio_8h.html#a52835ae37c4bb905b903cbaf5d04b05f">void</a>&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Get the thread identifier for the current thread. </p>

</div>
</div>
<a class="anchor" id="ac7ed1ec8dec5b902da25b60da2b728fa"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">DECLSPEC SDL_TLSID SDLCALL SDL_TLSCreate </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="SDL__audio_8h.html#a52835ae37c4bb905b903cbaf5d04b05f">void</a>&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Create an identifier that is globally visible to all threads but refers to data that is thread-specific. </p>
<dl class="section return"><dt>Returns</dt><dd>The newly created thread local storage identifier, or 0 on error</dd></dl>
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;static SDL_SpinLock tls_lock;</div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;static SDL_TLSID thread_local_storage;</div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;</div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;void SetMyThreadData(void *value)</div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;{</div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;    if (!thread_local_storage) {</div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;        SDL_AtomicLock(&amp;tls_lock);</div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;        if (!thread_local_storage) {</div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;            thread_local_storage = SDL_TLSCreate();</div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;        }</div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;        SDL_AtomicUnLock(&amp;tls_lock);</div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;    }</div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;    SDL_TLSSet(thread_local_storage, value);</div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;}</div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;</div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;void *GetMyThreadData(void)</div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;{</div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;    return SDL_TLSGet(thread_local_storage);</div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;}</div>
</div><!-- fragment --><dl class="section see"><dt>See also</dt><dd><a class="el" href="SDL__thread_8h.html#ab519f8d89ea808f32fc139071e6207bb" title="Get the value associated with a thread local storage ID for the current thread. ">SDL_TLSGet()</a> </dd>
<dd>
<a class="el" href="SDL__thread_8h.html#a73a9414493c106d9cb05d1a53d3412fc" title="Set the value associated with a thread local storage ID for the current thread. ">SDL_TLSSet()</a> </dd></dl>

</div>
</div>
<a class="anchor" id="ab519f8d89ea808f32fc139071e6207bb"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">DECLSPEC <a class="el" href="SDL__audio_8h.html#a52835ae37c4bb905b903cbaf5d04b05f">void</a>* SDLCALL SDL_TLSGet </td>
          <td>(</td>
          <td class="paramtype">SDL_TLSID&#160;</td>
          <td class="paramname"><em>id</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Get the value associated with a thread local storage ID for the current thread. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">id</td><td>The thread local storage ID</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The value associated with the ID for the current thread, or NULL if no value has been set.</dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="SDL__thread_8h.html#ac7ed1ec8dec5b902da25b60da2b728fa" title="Create an identifier that is globally visible to all threads but refers to data that is thread-specif...">SDL_TLSCreate()</a> </dd>
<dd>
<a class="el" href="SDL__thread_8h.html#a73a9414493c106d9cb05d1a53d3412fc" title="Set the value associated with a thread local storage ID for the current thread. ">SDL_TLSSet()</a> </dd></dl>

</div>
</div>
<a class="anchor" id="a73a9414493c106d9cb05d1a53d3412fc"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">DECLSPEC <a class="el" href="SDL__thread_8h.html#a6a64f9be4433e4de6e2f2f548cf3c08e">int</a> SDLCALL SDL_TLSSet </td>
          <td>(</td>
          <td class="paramtype">SDL_TLSID&#160;</td>
          <td class="paramname"><em>id</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="SDL__audio_8h.html#a52835ae37c4bb905b903cbaf5d04b05f">void</a> *&#160;</td>
          <td class="paramname"><em>value</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="SDL__audio_8h.html#a52835ae37c4bb905b903cbaf5d04b05f">void</a>(*)(<a class="el" href="SDL__audio_8h.html#a52835ae37c4bb905b903cbaf5d04b05f">void</a> *)&#160;</td>
          <td class="paramname"><em>destructor</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Set the value associated with a thread local storage ID for the current thread. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">id</td><td>The thread local storage ID </td></tr>
    <tr><td class="paramname">value</td><td>The value to associate with the ID for the current thread </td></tr>
    <tr><td class="paramname">destructor</td><td>A function called when the thread exits, to free the value.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>0 on success, -1 on error</dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="SDL__thread_8h.html#ac7ed1ec8dec5b902da25b60da2b728fa" title="Create an identifier that is globally visible to all threads but refers to data that is thread-specif...">SDL_TLSCreate()</a> </dd>
<dd>
<a class="el" href="SDL__thread_8h.html#ab519f8d89ea808f32fc139071e6207bb" title="Get the value associated with a thread local storage ID for the current thread. ">SDL_TLSGet()</a> </dd></dl>

</div>
</div>
<a class="anchor" id="ac96743626ed21d2cdb0868a23cca9705"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">DECLSPEC <a class="el" href="SDL__audio_8h.html#a52835ae37c4bb905b903cbaf5d04b05f">void</a> SDLCALL SDL_WaitThread </td>
          <td>(</td>
          <td class="paramtype">SDL_Thread *&#160;</td>
          <td class="paramname"><em>thread</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="SDL__thread_8h.html#a6a64f9be4433e4de6e2f2f548cf3c08e">int</a> *&#160;</td>
          <td class="paramname"><em>status</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Wait for a thread to finish. Threads that haven't been detached will remain (as a "zombie") until this function cleans them up. Not doing so is a resource leak.</p>
<p>Once a thread has been cleaned up through this function, the SDL_Thread that references it becomes invalid and should not be referenced again. As such, only one thread may call <a class="el" href="SDL__thread_8h.html#ac96743626ed21d2cdb0868a23cca9705">SDL_WaitThread()</a> on another.</p>
<p>The return code for the thread function is placed in the area pointed to by <code>status</code>, if <code>status</code> is not NULL.</p>
<p>You may not wait on a thread that has been used in a call to <a class="el" href="SDL__thread_8h.html#af90602c51ef5a62f26ed9931af484906">SDL_DetachThread()</a>. Use either that function or this one, but not both, or behavior is undefined.</p>
<p>It is safe to pass NULL to this function; it is a no-op. </p>

</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Thu Oct 16 2014 16:33:09 for My Project by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.8
</small></address>
</body>
</html>