📄 pthread_once.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><!-- Copyright 1997 The Open Group, All Rights Reserved --><title>pthread_once</title></head><body bgcolor=white><center><font size=2>The Single UNIX ® Specification, Version 2<br>Copyright © 1997 The Open Group</font></center><hr size=2 noshade><h4><a name = "tag_000_007_1567"> </a>NAME</h4><blockquote>pthread_once - dynamic package initialisation</blockquote><h4><a name = "tag_000_007_1568"> </a>SYNOPSIS</h4><blockquote><pre><code>#include <<a href="pthread.h.html">pthread.h</a>>int pthread_once(pthread_once_t *<i>once_control</i>, void (*<i>init_routine</i>)(void));pthread_once_t <i>once_control</i> = PTHREAD_ONCE_INIT;</code></pre></blockquote><h4><a name = "tag_000_007_1569"> </a>DESCRIPTION</h4><blockquote>The first call to<i>pthread_once()</i>by any thread in a process, with a given<i>once_control</i>,will call the<i>init_routine()</i>with no arguments.Subsequent calls of<i>pthread_once()</i>with the same<i>once_control</i>will not call the<i>init_routine()</i>.On return from<i>pthread_once()</i>,it is guaranteed that<i>init_routine()</i>has completed.The<i>once_control</i>parameter is used to determine whetherthe associated initialisation routine has been called.<p>The function<i>pthread_once()</i>is not a cancellation point.However, if<i>init_routine()</i>is a cancellation point and is canceled,the effect on<i>once_control</i>is as if<i>pthread_once()</i>was never called.<p>The constant PTHREAD_ONCE_INITis defined by the header<i><a href="pthread.h.html"><pthread.h></a></i>.<p>The behaviour of<i>pthread_once()</i>is undefined if<i>once_control</i>has automatic storage duration or is not initialised byPTHREAD_ONCE_INIT.</blockquote><h4><a name = "tag_000_007_1570"> </a>RETURN VALUE</h4><blockquote>Upon successful completion,<i>pthread_once()</i>returns zero.Otherwise, an error number is returned to indicate the error.</blockquote><h4><a name = "tag_000_007_1571"> </a>ERRORS</h4><blockquote>No errors are defined. <p>The<i>pthread_once()</i>function will not return an error code of [EINTR].</blockquote><h4><a name = "tag_000_007_1572"> </a>EXAMPLES</h4><blockquote>None.</blockquote><h4><a name = "tag_000_007_1573"> </a>APPLICATION USAGE</h4><blockquote>None.</blockquote><h4><a name = "tag_000_007_1574"> </a>FUTURE DIRECTIONS</h4><blockquote>None.</blockquote><h4><a name = "tag_000_007_1575"> </a>SEE ALSO</h4><blockquote><i><pthread,h></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 ® is a registered Trademark of The Open Group.<br>Copyright © 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 + -