⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pthread_key_create.html

📁 unix 下的C开发手册,还用详细的例程。
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><!-- Copyright 1997 The Open Group, All Rights Reserved --><title>pthread_key_create</title></head><body bgcolor=white><center><font size=2>The Single UNIX &reg; Specification, Version 2<br>Copyright &copy; 1997 The Open Group</font></center><hr size=2 noshade><h4><a name = "tag_000_007_1387">&nbsp;</a>NAME</h4><blockquote>pthread_key_create - thread-specific data key creation</blockquote><h4><a name = "tag_000_007_1388">&nbsp;</a>SYNOPSIS</h4><blockquote><pre><code>#include &lt;<a href="pthread.h.html">pthread.h</a>&gt;int pthread_key_create(pthread_key_t *<i>key</i>, void (*<i>destructor</i>)(void*));</code></pre></blockquote><h4><a name = "tag_000_007_1389">&nbsp;</a>DESCRIPTION</h4><blockquote>This function creates a thread-specific datakey visible to all threads in the process.Key values provided by<i>pthread_key_create()</i>are opaque objects used to locate thread-specific data.Although the same key value may be used by different threads,the values bound to the key by<i><a href="pthread_setspecific.html">pthread_setspecific()</a></i>are maintained on a per-thread basis and persistfor the life of the calling thread.<p>Upon key creation,the value NULL is associated with the new key in all active threads.Upon thread creation,the value NULL is associated with all defined keys in the new thread.<p>An optional destructor function may be associated witheach key value.At thread exit, if a key value has a non-NULL destructor pointer,and the thread has a non-NULL value associated with that key,the function pointed to is called with the current associated valueas its sole argument.The order of destructor calls is unspecifiedif more than one destructor exists for a thread when it exits.<p>If, after all the destructors have been called for all non-NULL valueswith associated destructors,there are still some non-NULL values with associated destructors,then the process will be repeated.If, after at least PTHREAD_DESTRUCTOR_ITERATIONSiterations of destructor calls for outstanding non-NULL values,there are still some non-NULL values with associated destructors,implementations may stop calling destructors,or they may continue calling destructorsuntil no non-NULL values with associated destructors exist,even though this might result in an infinite loop.</blockquote><h4><a name = "tag_000_007_1390">&nbsp;</a>RETURN VALUE</h4><blockquote>If successful, the<i>pthread_key_create()</i>function stores the newly created key value at<i>*key</i>and returns zero.Otherwise, an error number is returned to indicate the error.</blockquote><h4><a name = "tag_000_007_1391">&nbsp;</a>ERRORS</h4><blockquote>The <i>pthread_key_create()</i>function will fail if:<dl compact><dt>[EAGAIN]<dd>The system lacked the necessary resources to create another thread-specificdata key, or the system-imposed limit on the total number of keys per processPTHREAD_KEYS_MAX has been exceeded.<dt>[ENOMEM]<dd>Insufficient memory exists to create the key.</dl><p>The<i>pthread_key_create()</i>function will not return an error code of [EINTR].</blockquote><h4><a name = "tag_000_007_1392">&nbsp;</a>EXAMPLES</h4><blockquote>None.</blockquote><h4><a name = "tag_000_007_1393">&nbsp;</a>APPLICATION USAGE</h4><blockquote>None.</blockquote><h4><a name = "tag_000_007_1394">&nbsp;</a>FUTURE DIRECTIONS</h4><blockquote>None.</blockquote><h4><a name = "tag_000_007_1395">&nbsp;</a>SEE ALSO</h4><blockquote><i><a href="pthread_getspecific.html">pthread_getspecific()</a></i>,<i><a href="pthread_setspecific.html">pthread_setspecific()</a></i>,<i><a href="pthread_key_delete.html">pthread_key_delete()</a></i>,<i><a href="pthread.h.html">&lt;pthread.h&gt;</a></i>.</blockquote><h4>DERIVATION</h4><blockquote>Derived from the POSIX Threads Extension (1003.1c-1995)</blockquote><hr size=2 noshade><center><font size=2>UNIX &reg; is a registered Trademark of The Open Group.<br>Copyright &copy; 1997 The Open Group<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]</font></center><hr size=2 noshade></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -