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

📄 xsh_chap02_09.html

📁 IEEE 1003.1-2003, Single Unix Specification v3
💻 HTML
📖 第 1 页 / 共 4 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta name="generator" content="HTML Tidy, see www.w3.org"><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group's rhtm tool v1.2.1 --><!-- Copyright (c) 2001-2003 The Open Group, All Rights Reserved --><title>System Interfaces Chapter 2</title></head><body><script type="text/javascript" language="JavaScript" src="../jscript/codes.js"></script><basefont size="3"> <center><font size="2">The Open Group Base Specifications Issue 6<br>IEEE Std 1003.1-2001</font></center><hr size="2" noshade><h3><a name="tag_02_09"></a>Threads</h3><p><sup>[<a href="javascript:open_code('THR')">THR</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">The functionality described in this section is dependent on support of the Threads option (and the rest of this section is notfurther shaded for this option). <img src="../images/opt-end.gif" alt="[Option End]" border="0"></p><p>This section defines functionality to support multiple flows of control, called ``threads'', within a process. For thedefinition of threads, see the Base Definitions volume of IEEE&nbsp;Std&nbsp;1003.1-2001, <a href="../basedefs/xbd_chap03.html#tag_03_393">Section 3.393, Thread</a>.</p><p>The specific functional areas covered by threads and their scope include:</p><ul><li><p>Thread management: the creation, control, and termination of multiple flows of control in the same process under the assumptionof a common shared address space</p></li><li><p>Synchronization primitives optimized for tightly coupled operation of multiple control flows in a common, shared addressspace</p></li></ul><h4><a name="tag_02_09_01"></a>Thread-Safety</h4><p>All functions defined by this volume of IEEE&nbsp;Std&nbsp;1003.1-2001 shall be thread-safe, except that the followingfunctions<a href="#tag_foot_1"><sup><small>1</small></sup></a> need not be thread-safe.</p><table cellpadding="3"><tr valign="top"><td align="left"><p class="tent"><br><a href="../functions/asctime.html"><i>asctime</i>()</a><br><a href="../functions/basename.html"><i>basename</i>()</a><br><a href="../functions/catgets.html"><i>catgets</i>()</a><br><a href="../functions/crypt.html"><i>crypt</i>()</a><br><a href="../functions/ctime.html"><i>ctime</i>()</a><br><a href="../functions/dbm_clearerr.html"><i>dbm_clearerr</i>()</a><br><a href="../functions/dbm_close.html"><i>dbm_close</i>()</a><br><a href="../functions/dbm_delete.html"><i>dbm_delete</i>()</a><br><a href="../functions/dbm_error.html"><i>dbm_error</i>()</a><br><a href="../functions/dbm_fetch.html"><i>dbm_fetch</i>()</a><br><a href="../functions/dbm_firstkey.html"><i>dbm_firstkey</i>()</a><br><a href="../functions/dbm_nextkey.html"><i>dbm_nextkey</i>()</a><br><a href="../functions/dbm_open.html"><i>dbm_open</i>()</a><br><a href="../functions/dbm_store.html"><i>dbm_store</i>()</a><br><a href="../functions/dirname.html"><i>dirname</i>()</a><br><a href="../functions/dlerror.html"><i>dlerror</i>()</a><br><a href="../functions/drand48.html"><i>drand48</i>()</a><br>&nbsp;</p></td><td align="left"><p class="tent"><br><a href="../functions/ecvt.html"><i>ecvt</i>()</a><br><a href="../functions/encrypt.html"><i>encrypt</i>()</a><br><a href="../functions/endgrent.html"><i>endgrent</i>()</a><br><a href="../functions/endpwent.html"><i>endpwent</i>()</a><br><a href="../functions/endutxent.html"><i>endutxent</i>()</a><br><a href="../functions/fcvt.html"><i>fcvt</i>()</a><br><a href="../functions/ftw.html"><i>ftw</i>()</a><br><a href="../functions/gcvt.html"><i>gcvt</i>()</a><br><a href="../functions/getc_unlocked.html"><i>getc_unlocked</i>()</a><br><a href="../functions/getchar_unlocked.html"><i>getchar_unlocked</i>()</a><br><a href="../functions/getdate.html"><i>getdate</i>()</a><br><a href="../functions/getenv.html"><i>getenv</i>()</a><br><a href="../functions/getgrent.html"><i>getgrent</i>()</a><br><a href="../functions/getgrgid.html"><i>getgrgid</i>()</a><br><a href="../functions/getgrnam.html"><i>getgrnam</i>()</a><br><a href="../functions/gethostbyaddr.html"><i>gethostbyaddr</i>()</a><br><a href="../functions/gethostbyname.html"><i>gethostbyname</i>()</a><br>&nbsp;</p></td><td align="left"><p class="tent"><br><a href="../functions/gethostent.html"><i>gethostent</i>()</a><br><a href="../functions/getlogin.html"><i>getlogin</i>()</a><br><a href="../functions/getnetbyaddr.html"><i>getnetbyaddr</i>()</a><br><a href="../functions/getnetbyname.html"><i>getnetbyname</i>()</a><br><a href="../functions/getnetent.html"><i>getnetent</i>()</a><br><a href="../functions/getopt.html"><i>getopt</i>()</a><br><a href="../functions/getprotobyname.html"><i>getprotobyname</i>()</a><br><a href="../functions/getprotobynumber.html"><i>getprotobynumber</i>()</a><br><a href="../functions/getprotoent.html"><i>getprotoent</i>()</a><br><a href="../functions/getpwent.html"><i>getpwent</i>()</a><br><a href="../functions/getpwnam.html"><i>getpwnam</i>()</a><br><a href="../functions/getpwuid.html"><i>getpwuid</i>()</a><br><a href="../functions/getservbyname.html"><i>getservbyname</i>()</a><br><a href="../functions/getservbyport.html"><i>getservbyport</i>()</a><br><a href="../functions/getservent.html"><i>getservent</i>()</a><br><a href="../functions/getutxent.html"><i>getutxent</i>()</a><br><a href="../functions/getutxid.html"><i>getutxid</i>()</a><br>&nbsp;</p></td><td align="left"><p class="tent"><br><a href="../functions/getutxline.html"><i>getutxline</i>()</a><br><a href="../functions/gmtime.html"><i>gmtime</i>()</a><br><a href="../functions/hcreate.html"><i>hcreate</i>()</a><br><a href="../functions/hdestroy.html"><i>hdestroy</i>()</a><br><a href="../functions/hsearch.html"><i>hsearch</i>()</a><br><a href="../functions/inet_ntoa.html"><i>inet_ntoa</i>()</a><br><a href="../functions/l64a.html"><i>l64a</i>()</a><br><a href="../functions/lgamma.html"><i>lgamma</i>()</a><br><a href="../functions/lgammaf.html"><i>lgammaf</i>()</a><br><a href="../functions/lgammal.html"><i>lgammal</i>()</a><br><a href="../functions/localeconv.html"><i>localeconv</i>()</a><br><a href="../functions/localtime.html"><i>localtime</i>()</a><br><a href="../functions/lrand48.html"><i>lrand48</i>()</a><br><a href="../functions/mrand48.html"><i>mrand48</i>()</a><br><a href="../functions/nftw.html"><i>nftw</i>()</a><br><a href="../functions/nl_langinfo.html"><i>nl_langinfo</i>()</a><br><a href="../functions/ptsname.html"><i>ptsname</i>()</a><br>&nbsp;</p></td><td align="left"><p class="tent"><br><a href="../functions/putc_unlocked.html"><i>putc_unlocked</i>()</a><br><a href="../functions/putchar_unlocked.html"><i>putchar_unlocked</i>()</a><br><a href="../functions/putenv.html"><i>putenv</i>()</a><br><a href="../functions/pututxline.html"><i>pututxline</i>()</a><br><a href="../functions/rand.html"><i>rand</i>()</a><br><a href="../functions/readdir.html"><i>readdir</i>()</a><br><a href="../functions/setenv.html"><i>setenv</i>()</a><br><a href="../functions/setgrent.html"><i>setgrent</i>()</a><br><a href="../functions/setkey.html"><i>setkey</i>()</a><br><a href="../functions/setpwent.html"><i>setpwent</i>()</a><br><a href="../functions/setutxent.html"><i>setutxent</i>()</a><br><a href="../functions/strerror.html"><i>strerror</i>()</a><br><a href="../functions/strtok.html"><i>strtok</i>()</a><br><a href="../functions/ttyname.html"><i>ttyname</i>()</a><br><a href="../functions/unsetenv.html"><i>unsetenv</i>()</a><br><a href="../functions/wcstombs.html"><i>wcstombs</i>()</a><br><a href="../functions/wctomb.html"><i>wctomb</i>()</a><br>&nbsp;</p></td></tr></table><p>The <a href="../functions/ctermid.html"><i>ctermid</i>()</a> and <a href="../functions/tmpnam.html"><i>tmpnam</i>()</a>functions need not be thread-safe if passed a NULL argument. The <a href="../functions/wcrtomb.html"><i>wcrtomb</i>()</a> and <ahref="../functions/wcsrtombs.html"><i>wcsrtombs</i>()</a> functions need not be thread-safe if passed a NULL <i>ps</i>argument.</p><p>Implementations shall provide internal synchronization as necessary in order to satisfy this requirement.</p><h4><a name="tag_02_09_02"></a>Thread IDs</h4><p>Although implementations may have thread IDs that are unique in a system, applications should only assume that thread IDs areusable and unique within a single process. The effect of calling any of the functions defined in this volume ofIEEE&nbsp;Std&nbsp;1003.1-2001 and passing as an argument the thread ID of a thread from another process is unspecified. Aconforming implementation is free to reuse a thread ID after the thread terminates if it was created with the <i>detachstate</i>attribute set to PTHREAD_CREATE_DETACHED or if <a href="../functions/pthread_detach.html"><i>pthread_detach</i>()</a> or <a href="../functions/pthread_join.html"><i>pthread_join</i>()</a> has been called for that thread. If a thread is detached, its thread IDis invalid for use as an argument in a call to <a href="../functions/pthread_detach.html"><i>pthread_detach</i>()</a> or <a href="../functions/pthread_join.html"><i>pthread_join</i>()</a>.</p><h4><a name="tag_02_09_03"></a>Thread Mutexes</h4><p>A thread that has blocked shall not prevent any unblocked thread that is eligible to use the same processing resources fromeventually making forward progress in its execution. Eligibility for processing resources is determined by the schedulingpolicy.</p><p>A thread shall become the owner of a mutex, <i>m</i>, when one of the following occurs:</p><ul><li><p>It returns successfully from <a href="../functions/pthread_mutex_lock.html"><i>pthread_mutex_lock</i>()</a> with <i>m</i> as the<i>mutex</i> argument.</p></li><li><p>It returns successfully from <a href="../functions/pthread_mutex_trylock.html"><i>pthread_mutex_trylock</i>()</a> with <i>m</i>as the <i>mutex</i> argument.</p></li>

⌨️ 快捷键说明

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