pthread_mutexattr_init.txt

来自「Pthread lib库完整说明文档」· 文本 代码 · 共 121 行

TXT
121
字号
pthread_mutexattr_init SubroutinePurposeCreates a mutex attributes object and initializes it with defaultvalues.LibraryThreads Library (libpthreads.a)Syntax#include <pthread.h>int pthread_mutexattr_init (attr)pthread_mutexattr_t *attr;DescriptionThe pthread_mutexattr_init subroutine creates a new mutex attributesobject attr. The new mutex attributes object is initialized with thefollowing default values:------------------------------------------------------------------------------------------------------------------|Initialized if _POSIX_THREAD_PRIO_INHERIT is defined                                                           ||------------------------------------------------------------|---------------------------------------------------||Attribute                                                   |Defaultvalue                                      ||------------------------------------------------------------|---------------------------------------------------||Protocol                                                    |NO_PRIO_INHERIT                                   ||                                                            |thedefault ensures compatibility with             ||                                                            |implementationsthat do not support this POSIX     ||                                                            |option.                                           |------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|Initialized if _POSIX_THREAD_PRIO_PROTECT is defined                                                           ||------------------------------------------------------------|---------------------------------------------------||Attribute                                                   |Defaultvalue                                      ||------------------------------------------------------------|---------------------------------------------------||Prioceiling                                                 |1 (defaultthread priority)                        |------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|Initialized if _POSIX_THREAD_PROCESS_SHARED is defined                                                         ||------------------------------------------------------------|---------------------------------------------------||Attribute                                                   |Defaultvalue                                      ||------------------------------------------------------------|---------------------------------------------------||Process-shared                                              |PTHREAD_PROCESS_PRIVATE                           ||                                                            |thedefault ensures compatibility with             ||                                                            |implementationsthat do not support this POSIX     ||                                                            |option.                                           |------------------------------------------------------------------------------------------------------------------Note:	The pthread.h header file must be the first included file ofeach source file using the threads library.Parametersattr	Specifies the mutex attributes object to be created.Return ValuesUpon successful completion, the new mutex attributes object is filledwith default values and returned via the attr parameter, and 0 isreturned. Otherwise, an error code is returned.Error CodesThe pthread_mutexattr_init subroutine is unsuccessful if the followingis true:EINVAL	The attr parameter is not valid.ENOMEM	There is not sufficient memory to create the mutex attributesobject.Implementation SpecificsThis subroutine is part of the Base Operating System (BOS) Runtime.The priority inheritance, priority protection, and process sharingPOSIX options are not implemented in the current version of AIX.Related InformationThe pthread_mutexattr_setprioceiling subroutine, pthread_mutexattr_setprotocolsubroutine, pthread_mutexattr_setpshared subroutine, pthread_mutex_initsubroutine, pthread_mutexattr_destroy subroutine.Using Mutexes.Threads Library Options and Threads Library Quick Reference.

⌨️ 快捷键说明

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