<!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.5"/> <title>GNU CommonC++: ost::ThreadKey Class 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="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">GNU CommonC++ </div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.5 --> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li class="current"><a href="annotated.html"><span>Classes</span></a></li> <li><a href="files.html"><span>Files</span></a></li> <li><a href="examples.html"><span>Examples</span></a></li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="annotated.html"><span>Class List</span></a></li> <li><a href="classes.html"><span>Class Index</span></a></li> <li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li> <li><a href="functions.html"><span>Class Members</span></a></li> </ul> </div> <div id="nav-path" class="navpath"> <ul> <li class="navelem"><a class="el" href="namespaceost.html">ost</a></li><li class="navelem"><a class="el" href="classost_1_1_thread_key.html">ThreadKey</a></li> </ul> </div> </div><!-- top --> <div class="header"> <div class="summary"> <a href="#pub-methods">Public Member Functions</a> | <a href="#friends">Friends</a> | <a href="classost_1_1_thread_key-members.html">List of all members</a> </div> <div class="headertitle"> <div class="title">ost::ThreadKey Class Reference</div> </div> </div><!--header--> <div class="contents"> <p>This class allows the creation of a thread context unique "pointer" that can be set and retrieved and can be used to create thread specific data areas for implementing "thread safe" library routines. <a href="classost_1_1_thread_key.html#details">More...</a></p> <p><code>#include <<a class="el" href="thread_8h_source.html">thread.h</a>></code></p> <table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a> Public Member Functions</h2></td></tr> <tr class="memitem:a043483c6c7621ecea587d7c241dea50c"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_thread_key.html#a043483c6c7621ecea587d7c241dea50c">ThreadKey</a> ()</td></tr> <tr class="memdesc:a043483c6c7621ecea587d7c241dea50c"><td class="mdescLeft"> </td><td class="mdescRight">Create a unique thread specific container. <a href="#a043483c6c7621ecea587d7c241dea50c">More...</a><br/></td></tr> <tr class="separator:a043483c6c7621ecea587d7c241dea50c"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:ae2450333089e61ce432377977fc1e337"><td class="memItemLeft" align="right" valign="top">virtual </td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_thread_key.html#ae2450333089e61ce432377977fc1e337">~ThreadKey</a> ()</td></tr> <tr class="memdesc:ae2450333089e61ce432377977fc1e337"><td class="mdescLeft"> </td><td class="mdescRight">Destroy a thread specific container and any contents reserved. <a href="#ae2450333089e61ce432377977fc1e337">More...</a><br/></td></tr> <tr class="separator:ae2450333089e61ce432377977fc1e337"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a3b59c3887d643ce80af170663cb2551c"><td class="memItemLeft" align="right" valign="top">void * </td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_thread_key.html#a3b59c3887d643ce80af170663cb2551c">getKey</a> (void)</td></tr> <tr class="memdesc:a3b59c3887d643ce80af170663cb2551c"><td class="mdescLeft"> </td><td class="mdescRight">Get the value of the pointer for the thread specific data container. <a href="#a3b59c3887d643ce80af170663cb2551c">More...</a><br/></td></tr> <tr class="separator:a3b59c3887d643ce80af170663cb2551c"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a5569af7b992aa2fb67da7711225c99a6"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_thread_key.html#a5569af7b992aa2fb67da7711225c99a6">setKey</a> (void *)</td></tr> <tr class="memdesc:a5569af7b992aa2fb67da7711225c99a6"><td class="mdescLeft"> </td><td class="mdescRight">Set the value of the pointer for the current thread specific execution context. <a href="#a5569af7b992aa2fb67da7711225c99a6">More...</a><br/></td></tr> <tr class="separator:a5569af7b992aa2fb67da7711225c99a6"><td class="memSeparator" colspan="2"> </td></tr> </table><table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="friends"></a> Friends</h2></td></tr> <tr class="memitem:ae3c1cdb20d70b22a5c0bf395614eefff"><td class="memItemLeft" align="right" valign="top">class </td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_thread_key.html#ae3c1cdb20d70b22a5c0bf395614eefff">ThreadImpl</a></td></tr> <tr class="separator:ae3c1cdb20d70b22a5c0bf395614eefff"><td class="memSeparator" colspan="2"> </td></tr> </table> <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2> <div class="textblock"><p>This class allows the creation of a thread context unique "pointer" that can be set and retrieved and can be used to create thread specific data areas for implementing "thread safe" library routines. </p> <p>Finally, Common C++ supports a thread-safe "AtomicCounter" class. This can often be used for reference counting without having to protect the counter with a separate <a class="el" href="classost_1_1_mutex.html" title="The Mutex class is used to protect a section of code so that at any given time only a single thread c...">Mutex</a> counter. This lends to lighter-weight code.</p> <dl class="section author"><dt>Author</dt><dd>David Sugar <a href="#" onclick="location.href='mai'+'lto:'+'dyf'+'et'+'@os'+'te'+'l.c'+'om'; return false;">dyfet<span style="display: none;">.nosp@m.</span>@ost<span style="display: none;">.nosp@m.</span>el.co<span style="display: none;">.nosp@m.</span>m</a> container for thread specific data storage. </dd></dl> </div><h2 class="groupheader">Constructor & Destructor Documentation</h2> <a class="anchor" id="a043483c6c7621ecea587d7c241dea50c"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">ost::ThreadKey::ThreadKey </td> <td>(</td> <td class="paramname"></td><td>)</td> <td></td> </tr> </table> </div><div class="memdoc"> <p>Create a unique thread specific container. </p> </div> </div> <a class="anchor" id="ae2450333089e61ce432377977fc1e337"></a> <div class="memitem"> <div class="memproto"> <table class="mlabels"> <tr> <td class="mlabels-left"> <table class="memname"> <tr> <td class="memname">virtual ost::ThreadKey::~ThreadKey </td> <td>(</td> <td class="paramname"></td><td>)</td> <td></td> </tr> </table> </td> <td class="mlabels-right"> <span class="mlabels"><span class="mlabel">virtual</span></span> </td> </tr> </table> </div><div class="memdoc"> <p>Destroy a thread specific container and any contents reserved. </p> </div> </div> <h2 class="groupheader">Member Function Documentation</h2> <a class="anchor" id="a3b59c3887d643ce80af170663cb2551c"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void* ost::ThreadKey::getKey </td> <td>(</td> <td class="paramtype">void </td> <td class="paramname"></td><td>)</td> <td></td> </tr> </table> </div><div class="memdoc"> <p>Get the value of the pointer for the thread specific data container. </p> <p>A unique pointer can be set for each execution context.</p> <dl class="section return"><dt>Returns</dt><dd>a unique void * for each execution context. </dd></dl> </div> </div> <a class="anchor" id="a5569af7b992aa2fb67da7711225c99a6"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void ost::ThreadKey::setKey </td> <td>(</td> <td class="paramtype">void * </td> <td class="paramname"></td><td>)</td> <td></td> </tr> </table> </div><div class="memdoc"> <p>Set the value of the pointer for the current thread specific execution context. </p> <p>This can be used to store thread context specific data.</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">-</td><td>ptr to thread context specific data. </td></tr> </table> </dd> </dl> </div> </div> <h2 class="groupheader">Friends And Related Function Documentation</h2> <a class="anchor" id="ae3c1cdb20d70b22a5c0bf395614eefff"></a> <div class="memitem"> <div class="memproto"> <table class="mlabels"> <tr> <td class="mlabels-left"> <table class="memname"> <tr> <td class="memname">friend class ThreadImpl</td> </tr> </table> </td> <td class="mlabels-right"> <span class="mlabels"><span class="mlabel">friend</span></span> </td> </tr> </table> </div><div class="memdoc"> </div> </div> <hr/>The documentation for this class was generated from the following file:<ul> <li><a class="el" href="thread_8h_source.html">thread.h</a></li> </ul> </div><!-- contents --> <!-- start footer part --> <hr class="footer"/><address class="footer"><small> Generated on Thu Oct 17 2013 23:24:58 for GNU CommonC++ by  <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.5 </small></address> </body> </html>