pthreadlib.html
来自「Vxworks API操作系统和驱动程序设计API。压缩的HTML文件」· HTML 代码 · 共 1,229 行 · 第 1/5 页
HTML
1,229 行
<a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>pthread_condattr_destroy( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>pthread_condattr_destroy( )</strong> - destroy a condition attributes object (POSIX)</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>int pthread_condattr_destroy ( pthread_condattr_t * pAttr /* condition variable attributes */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine destroys the condition attribute object <i>pAttr</i>. It mustnot be reused until it is reinitialized.<p></blockquote><h4>RETURNS</h4><blockquote><p>Always returns zero.<p></blockquote><h4>ERRNOS</h4><blockquote><p>None.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./pthreadLib.html#top">pthreadLib</a></b>, <b><a href="./pthreadLib.html#pthread_cond_init">pthread_cond_init</a>( )</b>, <b><a href="./pthreadLib.html#pthread_condattr_init">pthread_condattr_init</a>( )</b><hr><a name="pthread_cond_init"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>pthread_cond_init( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>pthread_cond_init( )</strong> - initialize condition variable (POSIX)</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>int pthread_cond_init ( pthread_cond_t * pCond, /* condition variable */ pthread_condattr_t * pAttr /* condition variable attributes */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p><p>This function initializes a condition variable. A condition variableis a synchronization device that allows threads to block until somepredicate on shared data is satisfied. The basic operations on conditionsare to signal the condition (when the predicate becomes true), and waitfor the condition, blocking the thread until another thread signals thecondition.<p>A condition variable must always be associated with a mutex to avoid arace condition between the wait and signal operations.<p>If <i>pAttr</i> is NULL then the default attributes are used as specified byPOSIX; if <i>pAttr</i> is non-NULL then it is assumed to point to a conditionattributes object initialized by <b><a href="./pthreadLib.html#pthread_condattr_init">pthread_condattr_init</a>( )</b>, and those arethe attributes used to create the condition variable.<p></blockquote><h4>RETURNS</h4><blockquote><p>On success zero; on failure a non-zero error code.<p></blockquote><h4>ERRNOS</h4><blockquote><p><b>EINVAL</b>, <b>EBUSY</b><p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./pthreadLib.html#top">pthreadLib</a></b>, <b><a href="./pthreadLib.html#pthread_condattr_init">pthread_condattr_init</a>( )</b>, <b><a href="./pthreadLib.html#pthread_condattr_destroy">pthread_condattr_destroy</a>( )</b>, <b><a href="./pthreadLib.html#pthread_cond_broadcast">pthread_cond_broadcast</a>( )</b>, <b><a href="./pthreadLib.html#pthread_cond_destroy">pthread_cond_destroy</a>( )</b>, <b><a href="./pthreadLib.html#pthread_cond_signal">pthread_cond_signal</a>( )</b>, <b><a href="./pthreadLib.html#pthread_cond_timedwait">pthread_cond_timedwait</a>( )</b>, <b><a href="./pthreadLib.html#pthread_cond_wait">pthread_cond_wait</a>( )</b><hr><a name="pthread_cond_destroy"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>pthread_cond_destroy( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>pthread_cond_destroy( )</strong> - destroy a condition variable (POSIX)</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>int pthread_cond_destroy ( pthread_cond_t * pCond /* condition variable */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine destroys the condition variable pointed to by <i>pCond</i>. Nothreads can be waiting on the condition variable when this function iscalled. If there are threads waiting on the condition variable, then<b><a href="./pthreadLib.html#pthread_cond_destroy">pthread_cond_destroy</a>( )</b> returns <b>EBUSY</b>.<p></blockquote><h4>RETURNS</h4><blockquote><p>On success zero; on failure a non-zero error code.<p></blockquote><h4>ERRNOS</h4><blockquote><p><b>EINVAL</b>, <b>EBUSY</b><p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./pthreadLib.html#top">pthreadLib</a></b>, <b><a href="./pthreadLib.html#pthread_condattr_init">pthread_condattr_init</a>( )</b>, <b><a href="./pthreadLib.html#pthread_condattr_destroy">pthread_condattr_destroy</a>( )</b>, <b><a href="./pthreadLib.html#pthread_cond_broadcast">pthread_cond_broadcast</a>( )</b>, <b><a href="./pthreadLib.html#pthread_cond_init">pthread_cond_init</a>( )</b>, <b><a href="./pthreadLib.html#pthread_cond_signal">pthread_cond_signal</a>( )</b>, <b><a href="./pthreadLib.html#pthread_cond_timedwait">pthread_cond_timedwait</a>( )</b>, <b><a href="./pthreadLib.html#pthread_cond_wait">pthread_cond_wait</a>( )</b><hr><a name="pthread_cond_signal"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>pthread_cond_signal( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>pthread_cond_signal( )</strong> - unblock a thread waiting on a condition (POSIX)</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>int pthread_cond_signal ( pthread_cond_t * pCond )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine unblocks one thread waiting on the specified conditionvariable <i>pCond</i>. If no threads are waiting on the condition variable thenthis routine does nothing; if more than one thread is waiting, then one willbe released, but it is not specified which one.<p></blockquote><h4>RETURNS</h4><blockquote><p>On success zero; on failure a non-zero error code.<p></blockquote><h4>ERRNOS</h4><blockquote><p><b>EINVAL</b><p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./pthreadLib.html#top">pthreadLib</a></b>, <b><a href="./pthreadLib.html#pthread_condattr_init">pthread_condattr_init</a>( )</b>, <b><a href="./pthreadLib.html#pthread_condattr_destroy">pthread_condattr_destroy</a>( )</b>, <b><a href="./pthreadLib.html#pthread_cond_broadcast">pthread_cond_broadcast</a>( )</b>, <b><a href="./pthreadLib.html#pthread_cond_destroy">pthread_cond_destroy</a>( )</b>, <b><a href="./pthreadLib.html#pthread_cond_init">pthread_cond_init</a>( )</b>, <b><a href="./pthreadLib.html#pthread_cond_timedwait">pthread_cond_timedwait</a>( )</b>, <b><a href="./pthreadLib.html#pthread_cond_wait">pthread_cond_wait</a>( )</b><hr><a name="pthread_cond_broadcast"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>pthread_cond_broadcast( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>pthread_cond_broadcast( )</strong> - unblock all threads waiting on a condition (POSIX)</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>int pthread_cond_broadcast ( pthread_cond_t * pCond )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This function unblocks all threads blocked on the condition variable<i>pCond</i>. Nothing happens if no threads are waiting on the specified conditionvariable.<p></blockquote><h4>RETURNS</h4><blockquote><p>On success zero; on failure a non-zero error code.<p></blockquote><h4>ERRNOS</h4><blockquote><p><b>EINVAL</b><p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./pthreadLib.html#top">pthreadLib</a></b>, <b><a href="./pthreadLib.html#pthread_condattr_init">pthread_condattr_init</a>( )</b>, <b><a href="./pthreadLib.html#pthread_condattr_destroy">pthread_condattr_destroy</a>( )</b>, <b><a href="./pthreadLib.html#pthread_cond_destroy">pthread_cond_destroy</a>( )</b>, <b><a href="./pthreadLib.html#pthread_cond_init">pthread_cond_init</a>( )</b>, <b><a href="./pthreadLib.html#pthread_cond_signal">pthread_cond_signal</a>( )</b>, <b><a href="./pthreadLib.html#pthread_cond_timedwait">pthread_cond_timedwait</a>( )</b>, <b><a href="./pthreadLib.html#pthread_cond_wait">pthread_cond_wait</a>( )</b><hr><a name="pthread_cond_wait"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>pthread_cond_wait( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>pthread_cond_wait( )</strong> - wait for a condition variable (POSIX)</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>int pthread_cond_wait ( pthread_cond_t * pCond, /* condition variable */ pthread_mutex_t * pMutex /* POSIX mutex */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This function atomically releases the mutex <i>pMutex</i> and waits for thecondition variable <i>pCond</i> to be signalled by another thread. The mutexmust be locked by the calling thread when <b><a href="./pthreadLib.html#pthread_cond_wait">pthread_cond_wait</a>( )</b> is called; ifit is not then this function returns an error (<b>EINVAL</b>).<p>Before returning to the calling thread, <b><a href="./pthreadLib.html#pthread_cond_wait">pthread_cond_wait</a>( )</b> re-acquires themutex.<p></blockquote><h4>RETURNS</h4><blockquote><p>On success zero; on failure a non-zero error code.<p></blockquote><h4>ERRNOS</h4><blockquote><p><b>EINVAL</b><p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./pthreadLib.html#top">pthreadLib</a></b>, <b><a href="./pthreadLib.html#pthread_condattr_init">pthread_condattr_init</a>( )</b>, <b><a href="./pthreadLib.html#pthread_condattr_destroy">pthread_condattr_destroy</a>( )</b>, <b><a href="./pthreadLib.html#pthread_cond_broadcast">pthread_cond_broadcast</a>( )</b>, <b><a href="./pthreadLib.html#pthread_cond_destroy">pthread_cond_destroy</a>( )</b>, <b><a href="./pthreadLib.html#pthread_cond_init">pthread_cond_init</a>( )</b>, <b><a href="./pthreadLib.html#pthread_cond_signal">pthread_cond_signal</a>( )</b>, <b><a href="./pthreadLib.html#pthread_cond_timedwait">pthread_cond_timedwait</a>( )</b><hr><a name="pthread_cond_timedwait"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>pthread_cond_timedwait( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>pthread_cond_timedwait( )</strong> - wait for a condition variable with a timeout (POSIX)</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>int pthread_cond_timedwait ( pthread_cond_t * pCond, /* condition variable */ pthread_mutex_t * pMutex, /* POSIX mutex */ const struct timespec * pAbstime /* timeout time */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This function atomically releases the mutex <i>pMutex</i> and waits for anotherthread to signal the condition variable <i>pCond</i>. As with <b><a href="./pthreadLib.html#pthread_cond_wait">pthread_cond_wait</a>( )</b>,the mutex must be locked by the calling thread when <b><a href="./pthreadLib.html#pthread_cond_timedwait">pthread_cond_timedwait</a>( )</b>is called.<p>If the condition variable
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?