📄 pthread_cond_init.txt
字号:
pthread_cond_init SubroutinePurposeInitializes a condition variable and sets its attributes.LibraryThreads Library (libpthreads.a)Syntax#include <pthread.h>int pthread_cond_init (condition, attr)pthread_cond_t *condition;pthread_condattr_t *attr;DescriptionThe pthread_cond_init subroutine initializes a new condition variablecondition, and sets its attributes according the condition attributesobject attr.After initialization of the condition variable, the condition attributesobject can be reused for another condition variable initialization,or deleted.Note: The pthread.h header file must be the first included file ofeach source file using the threads library.Parameterscondition Specifies the condition to be created.attr Specifies the condition attributes object to use for initializingthe condition variable. If the value is NULL, the default attributesvalues are used.Return ValuesUpon successful completion, the new condition variable is returnedvia the condition parameter, and 0 is returned. Otherwise, an errorcode is returned.Error CodesThe pthread_cond_init subroutine is unsuccessful if the followingis true:EBUSY The condition condition is already in use: it was previouslycreated with by calling the pthread_cond_init subroutine, and notdestroyed by calling the pthread_cond_destroy subroutine.EINVAL The condition or attr parameters are not valid.Implementation SpecificsThis subroutine is part of the Base Operating System (BOS) Runtime.Related InformationThe pthread_condattr_init subroutine, pthread_condattr_destroy subroutine,pthread_cond_wait or pthread_cond_timedwait subroutine, pthread_cond_destroysubroutine, PTHREAD_COND_INITIALIZER macro.Using Condition Variables and Threads Library Quick Reference.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -