<!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"/> <title>GNU CommonC++: ost::ThreadKey Class Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css"/> </head> <body> <!-- Generated by Doxygen 1.6.3 --> <div class="navigation" id="top"> <div class="tabs"> <ul> <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 class="tabs"> <ul> <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 class="navpath"><a class="el" href="namespaceost.html">ost</a>::<a class="el" href="classost_1_1_thread_key.html">ThreadKey</a> </div> </div> <div class="contents"> <h1>ost::ThreadKey Class Reference</h1><!-- doxytag: class="ost::ThreadKey" --> <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="#_details">More...</a></p> <p><code>#include <<a class="el" href="thread_8h_source.html">thread.h</a>></code></p> <p><a href="classost_1_1_thread_key-members.html">List of all members.</a></p> <table border="0" cellpadding="0" cellspacing="0"> <tr><td colspan="2"><h2>Public Member Functions</h2></td></tr> <tr><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><td class="mdescLeft"> </td><td class="mdescRight">Create a unique thread specific container. <a href="#a043483c6c7621ecea587d7c241dea50c"></a><br/></td></tr> <tr><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><td class="mdescLeft"> </td><td class="mdescRight">Destroy a thread specific container and any contents reserved. <a href="#ae2450333089e61ce432377977fc1e337"></a><br/></td></tr> <tr><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><td class="mdescLeft"> </td><td class="mdescRight">Get the value of the pointer for the thread specific data container. <a href="#a3b59c3887d643ce80af170663cb2551c"></a><br/></td></tr> <tr><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><td class="mdescLeft"> </td><td class="mdescRight">Set the value of the pointer for the current thread specific execution context. <a href="#a5569af7b992aa2fb67da7711225c99a6"></a><br/></td></tr> <tr><td colspan="2"><h2>Friends</h2></td></tr> <tr><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> </table> <hr/><a name="_details"></a><h2>Detailed Description</h2> <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...">Mutex</a> counter. This lends to lighter-weight code.</p> <dl class="author"><dt><b>Author:</b></dt><dd>David Sugar <<a href="mailto:dyfet@ostel.com">dyfet@ostel.com</a>> container for thread specific data storage. </dd></dl> <hr/><h2>Constructor & Destructor Documentation</h2> <a class="anchor" id="a043483c6c7621ecea587d7c241dea50c"></a><!-- doxytag: member="ost::ThreadKey::ThreadKey" ref="a043483c6c7621ecea587d7c241dea50c" args="()" --> <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><!-- doxytag: member="ost::ThreadKey::~ThreadKey" ref="ae2450333089e61ce432377977fc1e337" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">virtual ost::ThreadKey::~ThreadKey </td> <td>(</td> <td class="paramname"></td> <td> ) </td> <td><code> [virtual]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Destroy a thread specific container and any contents reserved. </p> </div> </div> <hr/><h2>Member Function Documentation</h2> <a class="anchor" id="a3b59c3887d643ce80af170663cb2551c"></a><!-- doxytag: member="ost::ThreadKey::getKey" ref="a3b59c3887d643ce80af170663cb2551c" args="(void)" --> <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="return"><dt><b>Returns:</b></dt><dd>a unique void * for each execution context. </dd></dl> </div> </div> <a class="anchor" id="a5569af7b992aa2fb67da7711225c99a6"></a><!-- doxytag: member="ost::ThreadKey::setKey" ref="a5569af7b992aa2fb67da7711225c99a6" args="(void *)" --> <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><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>-</em> </td><td>ptr to thread context specific data. </td></tr> </table> </dd> </dl> </div> </div> <hr/><h2>Friends And Related Function Documentation</h2> <a class="anchor" id="ae3c1cdb20d70b22a5c0bf395614eefff"></a><!-- doxytag: member="ost::ThreadKey::ThreadImpl" ref="ae3c1cdb20d70b22a5c0bf395614eefff" args="" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">friend class ThreadImpl<code> [friend]</code></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> <hr class="footer"/><address style="text-align: right;"><small>Generated on Fri Mar 12 10:07:42 2010 for GNU CommonC++ by <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address> </body> </html>