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

📄 xsh_chap02_09.html

📁 IEEE 1003.1-2003, Single Unix Specification v3
💻 HTML
📖 第 1 页 / 共 4 页
字号:
<a href="../functions/pclose.html"><i>pclose</i>()</a><br><a href="../functions/perror.html"><i>perror</i>()</a><br><a href="../functions/popen.html"><i>popen</i>()</a><br><a href="../functions/posix_fadvise.html"><i>posix_fadvise</i>()</a><br><a href="../functions/posix_fallocate.html"><i>posix_fallocate</i>()</a><br><a href="../functions/posix_madvise.html"><i>posix_madvise</i>()</a><br><a href="../functions/posix_spawn.html"><i>posix_spawn</i>()</a><br><a href="../functions/posix_spawnp.html"><i>posix_spawnp</i>()</a><br><a href="../functions/posix_trace_clear.html"><i>posix_trace_clear</i>()</a><br><a href="../functions/posix_trace_close.html"><i>posix_trace_close</i>()</a><br><a href="../functions/posix_trace_create.html"><i>posix_trace_create</i>()</a><br><a href="../functions/posix_trace_create_withlog.html"><i>posix_trace_create_withlog</i>()</a><br><a href="../functions/posix_trace_eventtypelist_getnext_id.html"><i>posix_trace_eventtypelist_getnext_id</i>()</a><br><a href="../functions/posix_trace_eventtypelist_rewind.html"><i>posix_trace_eventtypelist_rewind</i>()</a><br><a href="../functions/posix_trace_flush.html"><i>posix_trace_flush</i>()</a><br><a href="../functions/posix_trace_get_attr.html"><i>posix_trace_get_attr</i>()</a><br><a href="../functions/posix_trace_get_filter.html"><i>posix_trace_get_filter</i>()</a><br><a href="../functions/posix_trace_get_status.html"><i>posix_trace_get_status</i>()</a><br><a href="../functions/posix_trace_getnext_event.html"><i>posix_trace_getnext_event</i>()</a><br><a href="../functions/posix_trace_open.html"><i>posix_trace_open</i>()</a><br><a href="../functions/posix_trace_rewind.html"><i>posix_trace_rewind</i>()</a><br><a href="../functions/posix_trace_set_filter.html"><i>posix_trace_set_filter</i>()</a><br><a href="../functions/posix_trace_shutdown.html"><i>posix_trace_shutdown</i>()</a><br><a href="../functions/posix_trace_timedgetnext_event.html"><i>posix_trace_timedgetnext_event</i>()</a><br><a href="../functions/posix_typed_mem_open.html"><i>posix_typed_mem_open</i>()</a><br><a href="../functions/printf.html"><i>printf</i>()</a><br><a href="../functions/pthread_rwlock_rdlock.html"><i>pthread_rwlock_rdlock</i>()</a><br><a href="../functions/pthread_rwlock_timedrdlock.html"><i>pthread_rwlock_timedrdlock</i>()</a><br><a href="../functions/pthread_rwlock_timedwrlock.html"><i>pthread_rwlock_timedwrlock</i>()</a><br>&nbsp;</p></td><td align="left"><p class="tent"><br><a href="../functions/pthread_rwlock_wrlock.html"><i>pthread_rwlock_wrlock</i>()</a><br><a href="../functions/putc.html"><i>putc</i>()</a><br><a href="../functions/putc_unlocked.html"><i>putc_unlocked</i>()</a><br><a href="../functions/putchar.html"><i>putchar</i>()</a><br><a href="../functions/putchar_unlocked.html"><i>putchar_unlocked</i>()</a><br><a href="../functions/puts.html"><i>puts</i>()</a><br><a href="../functions/pututxline.html"><i>pututxline</i>()</a><br><a href="../functions/putwc.html"><i>putwc</i>()</a><br><a href="../functions/putwchar.html"><i>putwchar</i>()</a><br><a href="../functions/readdir.html"><i>readdir</i>()</a><br><a href="../functions/readdir_r.html"><i>readdir_r</i>()</a><br><a href="../functions/remove.html"><i>remove</i>()</a><br><a href="../functions/rename.html"><i>rename</i>()</a><br><a href="../functions/rewind.html"><i>rewind</i>()</a><br><a href="../functions/rewinddir.html"><i>rewinddir</i>()</a><br><a href="../functions/scanf.html"><i>scanf</i>()</a><br><a href="../functions/seekdir.html"><i>seekdir</i>()</a><br><a href="../functions/semop.html"><i>semop</i>()</a><br><a href="../functions/setgrent.html"><i>setgrent</i>()</a><br><a href="../functions/sethostent.html"><i>sethostent</i>()</a><br><a href="../functions/setnetent.html"><i>setnetent</i>()</a><br><a href="../functions/setprotoent.html"><i>setprotoent</i>()</a><br><a href="../functions/setpwent.html"><i>setpwent</i>()</a><br><a href="../functions/setservent.html"><i>setservent</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/syslog.html"><i>syslog</i>()</a><br><a href="../functions/tmpfile.html"><i>tmpfile</i>()</a><br><a href="../functions/tmpnam.html"><i>tmpnam</i>()</a><br><a href="../functions/ttyname.html"><i>ttyname</i>()</a><br><a href="../functions/ttyname_r.html"><i>ttyname_r</i>()</a><br><a href="../functions/ungetc.html"><i>ungetc</i>()</a><br><a href="../functions/ungetwc.html"><i>ungetwc</i>()</a><br><a href="../functions/unlink.html"><i>unlink</i>()</a><br><a href="../functions/vfprintf.html"><i>vfprintf</i>()</a><br><a href="../functions/vfwprintf.html"><i>vfwprintf</i>()</a><br><a href="../functions/vprintf.html"><i>vprintf</i>()</a><br><a href="../functions/vwprintf.html"><i>vwprintf</i>()</a><br><a href="../functions/wprintf.html"><i>wprintf</i>()</a><br><a href="../functions/wscanf.html"><i>wscanf</i>()</a><br>&nbsp;</p></td></tr></table><p>An implementation shall not introduce cancellation points into any other functions specified in this volume ofIEEE&nbsp;Std&nbsp;1003.1-2001.</p><p>The side effects of acting upon a cancellation request while suspended during a call of a function are the same as the sideeffects that may be seen in a single-threaded program when a call to a function is interrupted by a signal and the given functionreturns [EINTR]. Any such side effects occur before any cancellation cleanup handlers are called.</p><p>Whenever a thread has cancelability enabled and a cancellation request has been made with that thread as the target, and thethread then calls any function that is a cancellation point (such as <a href="../functions/pthread_testcancel.html"><i>pthread_testcancel</i>()</a> or <a href="../functions/read.html"><i>read</i>()</a>), thecancellation request shall be acted upon before the function returns. If a thread has cancelability enabled and a cancellationrequest is made with the thread as a target while the thread is suspended at a cancellation point, the thread shall be awakened andthe cancellation request shall be acted upon. However, if the thread is suspended at a cancellation point and the event for whichit is waiting occurs before the cancellation request is acted upon, it is unspecified whether the cancellation request is actedupon or whether the cancellation request remains pending and the thread resumes normal execution.</p><h5><a name="tag_02_09_05_03"></a>Thread Cancellation Cleanup Handlers</h5><p>Each thread maintains a list of cancellation cleanup handlers. The programmer uses the <a href="../functions/pthread_cleanup_push.html"><i>pthread_cleanup_push</i>()</a> and <a href="../functions/pthread_cleanup_pop.html"><i>pthread_cleanup_pop</i>()</a> functions to place routines on and remove routines fromthis list.</p><p>When a cancellation request is acted upon, the routines in the list are invoked one by one in LIFO sequence; that is, the lastroutine pushed onto the list (Last In) is the first to be invoked (First Out). The thread invokes the cancellation cleanup handlerwith cancellation disabled until the last cancellation cleanup handler returns. When the cancellation cleanup handler for a scopeis invoked, the storage for that scope remains valid. If the last cancellation cleanup handler returns, thread execution isterminated and a status of PTHREAD_CANCELED is made available to any threads joining with the target. The symbolic constantPTHREAD_CANCELED expands to a constant expression of type ( <b>void *</b>) whose value matches no pointer to an object in memorynor the value NULL.</p><p>The cancellation cleanup handlers are also invoked when the thread calls <a href="../functions/pthread_exit.html"><i>pthread_exit</i>()</a>.</p><p>A side effect of acting upon a cancellation request while in a condition variable wait is that the mutex is re-acquired beforecalling the first cancellation cleanup handler. In addition, the thread is no longer considered to be waiting for the condition andthe thread shall not have consumed any pending condition signals on the condition.</p><p>A cancellation cleanup handler cannot exit via <a href="../functions/longjmp.html"><i>longjmp</i>()</a> or <a href="../functions/siglongjmp.html"><i>siglongjmp</i>()</a>.</p><h5><a name="tag_02_09_05_04"></a>Async-Cancel Safety</h5><p>The <a href="../functions/pthread_cancel.html"><i>pthread_cancel</i>()</a>, <a href="../functions/pthread_setcancelstate.html"><i>pthread_setcancelstate</i>()</a>, and <a href="../functions/pthread_setcanceltype.html"><i>pthread_setcanceltype</i>()</a> functions are defined to be async-cancel safe.</p><p>No other functions in this volume of IEEE&nbsp;Std&nbsp;1003.1-2001 are required to be async-cancel-safe.</p><h4><a name="tag_02_09_06"></a>Thread Read-Write Locks</h4><p>Multiple readers, single writer (read-write) locks allow many threads to have simultaneous read-only access to data whileallowing only one thread to have exclusive write access at any given time. They are typically used to protect data that is readmore frequently than it is changed.</p><p>One or more readers acquire read access to the resource by performing a read lock operation on the associated read-write lock. Awriter acquires exclusive write access by performing a write lock operation. Basically, all readers exclude any writers and awriter excludes all readers and any other writers.</p><p>A thread that has blocked on a read-write lock (for example, has not yet returned from a <a href="../functions/pthread_rwlock_rdlock.html"><i>pthread_rwlock_rdlock</i>()</a> or <a href="../functions/pthread_rwlock_wrlock.html"><i>pthread_rwlock_wrlock</i>()</a> call) shall not prevent any unblocked thread that iseligible to use the same processing resources from eventually making forward progress in its execution. Eligibility for processingresources shall be determined by the scheduling policy.</p><p>Read-write locks can be used to synchronize threads in the current process and other processes if they are allocated in memorythat is writable and shared among the cooperating processes and have been initialized for this behavior.</p><h4><a name="tag_02_09_07"></a>Thread Interactions with Regular File Operations</h4><p>All of the functions <a href="../functions/chmod.html"><i>chmod</i>()</a>, <a href="../functions/close.html"><i>close</i>()</a>,<a href="../functions/fchmod.html"><i>fchmod</i>()</a>, <a href="../functions/fcntl.html"><i>fcntl</i>()</a>, <a href="../functions/fstat.html"><i>fstat</i>()</a>, <a href="../functions/ftruncate.html"><i>ftruncate</i>()</a>, <a href="../functions/lseek.html"><i>lseek</i>()</a>, <a href="../functions/open.html"><i>open</i>()</a>, <a href="../functions/read.html"><i>read</i>()</a>, <a href="../functions/readlink.html"><i>readlink</i>()</a>, <a href="../functions/stat.html"><i>stat</i>()</a>, <a href="../functions/symlink.html"><i>symlink</i>()</a>, and <a href="../functions/write.html"><i>write</i>()</a> shall be atomic with respect to each other in the effects specified inIEEE&nbsp;Std&nbsp;1003.1-2001 when they operate on regular files. If two threads each call one of these functions, each call shalleither see all of the specified effects of the other call, or none of them.</p><hr><h4><a name="tag_02_09_08"></a>Footnotes</h4><dl compact><dt><a name="tag_foot_1">1.</a></dt><dd>The functions in the table are not shaded to denote applicable options. Individual reference pages should be consulted.</dd><dt><a name="tag_foot_2">2.</a></dt><dd>When the <i>cmd</i> argument is F_SETLKW.</dd><dt><a name="tag_foot_3">3.</a></dt><dd>For any value of the <i>cmd</i> argument.</dd></dl><hr size="2" noshade><center><font size="2"><!--footer start-->UNIX &reg; is a registered Trademark of The Open Group.<br>POSIX &reg; is a registered Trademark of The IEEE.<br>[ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href="../utilities/contents.html">XCU</a> | <a href="../functions/contents.html">XSH</a> | <a href="../xrat/contents.html">XRAT</a>]</font></center><!--footer end--><hr size="2" noshade></body></html>

⌨️ 快捷键说明

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