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

📄 pthread.3

📁 Linux下的中文输入法
💻 3
📖 第 1 页 / 共 5 页
字号:
None..SH "APPLICATION USAGE".IX Header "APPLICATION USAGE"After these attributes have been set, a thread can be created with thespecified attributes using \fI\fIpthread_create()\fI\fR. Using these routinesdoes not affect the current running thread..SH "FUTURE DIRECTIONS".IX Header "FUTURE DIRECTIONS"None..SH "SEE ALSO".IX Header "SEE ALSO"\&\fI\fIpthread_attr_init()\fI\fR,\&\fI\fIpthread_attr_setscope()\fI\fR,\&\fI\fIpthread_attr_setschedpolicy()\fI\fR,\&\fI\fIpthread_attr_setschedparam()\fI\fR,\&\fI\fIpthread_create()\fI\fR,\&\fI<pthread.h\fR>,\&\fI\fIpthread_setschedparam()\fI\fR,\&\fI<sched.h\fR>..SH "_\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|_".IX Header "______________________________________________________________________".SH "NAME"\&\fBpthread_attr_setschedparam,\fR \fBpthread_attr_getschedparam\fR\&\- set and get schedparam attribute.SH "SYNOPSIS".IX Header "SYNOPSIS"#include <pthread.h>.PPint pthread_attr_setschedparam(pthread_attr_t *\fIattr\fR, const struct sched_param *\fIparam\fR);.PPint pthread_attr_getschedparam(const pthread_attr_t *\fIattr\fR, struct sched_param *\fIparam\fR);.SH "DESCRIPTION".IX Header "DESCRIPTION"The functions \fI\fIpthread_attr_setschedparam()\fI\fR and\&\fI\fIpthread_attr_getschedparam()\fI\fR, respectively, set and get thescheduling parameter attributes in the \fIattr\fR argument. The contents ofthe \fIparam\fR structure are defined in \fI<sched.h\fR>. For the \s-1SCHED_FIFO\s0and \s-1SCHED_RR\s0 policies, the only required member of \fIparam\fR is\&\fIsched_priority\fR..SH "RETURN VALUE".IX Header "RETURN VALUE"If successful, the \fI\fIpthread_attr_setschedparam()\fI\fR and\&\fI\fIpthread_attr_getschedparam()\fI\fR functions return zero. Otherwise, anerror number is returned to indicate the error..SH "ERRORS".IX Header "ERRORS"The \fI\fIpthread_attr_setschedparam()\fI\fR function may fail if:.IP "[\s-1EINVAL\s0]" 4.IX Item "[EINVAL]"The value of the attribute being set is not valid..IP "[\s-1ENOTSUP\s0]" 4.IX Item "[ENOTSUP]"An attempt was made to set the attribute to an unsupported value..PPThe\&\fI\fIpthread_attr_setschedparam()\fI\fRand\&\fI\fIpthread_attr_getschedparam()\fI\fRfunctions will not return an error code of [\s-1EINTR\s0]..SH "EXAMPLES".IX Header "EXAMPLES"None..SH "APPLICATION USAGE".IX Header "APPLICATION USAGE"After these attributes have been set, a thread can be created with thespecified attributes using \fI\fIpthread_create()\fI\fR. Using these routinesdoes not affect the current running thread..SH "FUTURE DIRECTIONS".IX Header "FUTURE DIRECTIONS"None..SH "SEE ALSO".IX Header "SEE ALSO"\&\fI\fIpthread_attr_init()\fI\fR,\&\fI\fIpthread_attr_setscope()\fI\fR,\&\fI\fIpthread_attr_setinheritsched()\fI\fR,\&\fI\fIpthread_attr_setschedpolicy()\fI\fR,\&\fI\fIpthread_create()\fI\fR,\&\fI<pthread.h\fR>,\&\fI\fIpthread_setschedparam()\fI\fR,\&\fI<sched.h\fR>..SH "_\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|_".IX Header "______________________________________________________________________".SH "NAME"\&\fBpthread_attr_setschedpolicy,\fR \fBpthread_attr_getschedpolicy\fR\&\- set and get schedpolicy attribute(\fBREALTIME THREADS\fR).SH "SYNOPSIS".IX Header "SYNOPSIS"#include <pthread.h>.PPint pthread_attr_setschedpolicy(pthread_attr_t *\fIattr\fR, int \fIpolicy\fR);int pthread_attr_getschedpolicy(const pthread_attr_t *\fIattr\fR,int *\fIpolicy\fR);.SH "DESCRIPTION".IX Header "DESCRIPTION"The functions \fI\fIpthread_attr_setschedpolicy()\fI\fR and\&\fI\fIpthread_attr_getschedpolicy()\fI\fR, respectively, set and get the\&\fIschedpolicy\fR attribute in the \fIattr\fR argument..PPThe supported values of \fIpolicy\fR include \s-1SCHED_FIFO\s0, \s-1SCHED_RR\s0 and\&\s-1SCHED_OTHER\s0, which are defined by the header \fI<sched.h\fR>. When threadsexecuting with the scheduling policy \s-1SCHED_FIFO\s0 or \s-1SCHED_RR\s0 are waitingon a mutex, they acquire the mutex in priority order when the mutex isunlocked..SH "RETURN VALUE".IX Header "RETURN VALUE"If successful, the \fI\fIpthread_attr_setschedpolicy()\fI\fR and\&\fI\fIpthread_attr_getschedpolicy()\fI\fR functions return zero. Otherwise, anerror number is returned to indicate the error..SH "ERRORS".IX Header "ERRORS"The \fI\fIpthread_attr_setschedpolicy()\fI\fR and\&\fI\fIpthread_attr_getschedpolicy()\fI\fR functions will fail if:.IP "[\s-1ENOSYS\s0]" 4.IX Item "[ENOSYS]"The option _POSIX_THREAD_PRIORITY_SCHEDULING is not defined and theimplementation does not support the function..PPThe \fI\fIpthread_attr_setschedpolicy()\fI\fR function may fail if:.IP "[\s-1EINVAL\s0]" 4.IX Item "[EINVAL]"The value of the attribute being set is not valid..IP "[\s-1ENOTSUP\s0]" 4.IX Item "[ENOTSUP]"An attempt was made to set the attribute to an unsupported value..SH "EXAMPLES".IX Header "EXAMPLES"None..SH "APPLICATION USAGE".IX Header "APPLICATION USAGE"After these attributes have been set, a thread can be created with thespecified attributes using \fI\fIpthread_create()\fI\fR. Using these routinesdoes not affect the current running thread..SH "FUTURE DIRECTIONS".IX Header "FUTURE DIRECTIONS"None..SH "SEE ALSO".IX Header "SEE ALSO"\&\fI\fIpthread_attr_init()\fI\fR,\&\fI\fIpthread_attr_setscope()\fI\fR,\&\fI\fIpthread_attr_setinheritsched()\fI\fR,\&\fI\fIpthread_attr_setschedparam()\fI\fR,\&\fI\fIpthread_create()\fI\fR,\&\fI<pthread.h\fR>,\&\fI\fIpthread_setschedparam()\fI\fR,\&\fI<sched.h\fR>..SH "_\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|_".IX Header "______________________________________________________________________".SH "NAME"\&\fBpthread_attr_setscope,\fR \fBpthread_attr_getscope\fR\&\- set and get contentionscope attribute(\fBREALTIME THREADS\fR).SH "SYNOPSIS".IX Header "SYNOPSIS"#include <pthread.h>.PPint pthread_attr_setscope(pthread_attr_t *\fIattr\fR, int \fIcontentionscope\fR);int pthread_attr_getscope(const pthread_attr_t *\fIattr\fR,int *\fIcontentionscope\fR);.SH "DESCRIPTION".IX Header "DESCRIPTION"The \fI\fIpthread_attr_setscope()\fI\fR and \fI\fIpthread_attr_getscope()\fI\fR functionsare used to set and get the \fIcontentionscope\fR attribute in the \fIattr\fRobject..PPThe \fIcontentionscope\fR attribute may have the values\&\s-1PTHREAD_SCOPE_SYSTEM\s0, signifying system scheduling contention scope, or\&\s-1PTHREAD_SCOPE_PROCESS\s0, signifying process scheduling contention scope.The symbols \s-1PTHREAD_SCOPE_SYSTEM\s0 and \s-1PTHREAD_SCOPE_PROCESS\s0 are definedby the header \fI<pthread.h\fR>..SH "RETURN VALUE".IX Header "RETURN VALUE"If successful, the \fI\fIpthread_attr_setscope()\fI\fR and\&\fI\fIpthread_attr_getscope()\fI\fR functions return zero. Otherwise, an errornumber is returned to indicate the error..SH "ERRORS".IX Header "ERRORS"The \fI\fIpthread_attr_setscope()\fI\fR and \fI\fIpthread_attr_getscope()\fI\fR functionswill fail if:.IP "[\s-1ENOSYS\s0]" 4.IX Item "[ENOSYS]"The option _POSIX_THREAD_PRIORITY_SCHEDULING is not defined and theimplementation does not support the function..PPThe\&\fI\fIpthread_attr_setscope()\fI\fR,function may fail if:.IP "[\s-1EINVAL\s0]" 4.IX Item "[EINVAL]"The value of the attribute being set is not valid..IP "[\s-1ENOTSUP\s0]" 4.IX Item "[ENOTSUP]"An attempt was made to set the attribute to an unsupported value..SH "EXAMPLES".IX Header "EXAMPLES"None..SH "APPLICATION USAGE".IX Header "APPLICATION USAGE"After these attributes have been set, a thread can be created with thespecified attributes using \fI\fIpthread_create()\fI\fR. Using these routinesdoes not affect the current running thread..SH "FUTURE DIRECTIONS".IX Header "FUTURE DIRECTIONS"None..SH "SEE ALSO".IX Header "SEE ALSO"\&\fI\fIpthread_attr_init()\fI\fR,\&\fI\fIpthread_attr_setinheritsched()\fI\fR,\&\fI\fIpthread_attr_setschedpolicy()\fI\fR,\&\fI\fIpthread_attr_setschedparam()\fI\fR,\&\fI\fIpthread_create()\fI\fR,\&\fI<pthread.h\fR>,\&\fI\fIpthread_setschedparam()\fI\fR,\&\fI<sched.h\fR>..SH "_\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|_".IX Header "______________________________________________________________________".SH "NAME"\&\fBpthread_attr_setstackaddr,\fR \fBpthread_attr_getstackaddr\fR\&\- set and get stackaddr attribute.SH "SYNOPSIS".IX Header "SYNOPSIS"#include <pthread.h>.PPint pthread_attr_setstackaddr(pthread_attr_t *\fIattr\fR, void *\fIstackaddr\fR);.PPint pthread_attr_getstackaddr(const pthread_attr_t *\fIattr\fR, void **\fIstackaddr\fR);.SH "DESCRIPTION".IX Header "DESCRIPTION"The functions \fI\fIpthread_attr_setstackaddr()\fI\fR and\&\fI\fIpthread_attr_getstackaddr()\fI\fR, respectively, set and get the threadcreation \fIstackaddr\fR attribute in the \fIattr\fR object..PPThe \fIstackaddr\fR attribute specifies the location of storage to be usedfor the created thread's stack. The size of the storage is at least\&\s-1PTHREAD_STACK_MIN\s0..SH "RETURN VALUE".IX Header "RETURN VALUE"Upon successful completion, \fI\fIpthread_attr_setstackaddr()\fI\fR and\&\fI\fIpthread_attr_getstackaddr()\fI\fR return a value of 0. Otherwise, an errornumber is returned to indicate the error..PPThe \fI\fIpthread_attr_getstackaddr()\fI\fR function stores the \fIstackaddr\fRattribute value in \fIstackaddr\fR if successful..SH "ERRORS".IX Header "ERRORS"No errors are defined..PPThese functions will not return an error code of [\s-1EINTR\s0]..SH "EXAMPLES".IX Header "EXAMPLES"None..SH "APPLICATION USAGE".IX Header "APPLICATION USAGE"None..SH "FUTURE DIRECTIONS".IX Header "FUTURE DIRECTIONS"None..SH "SEE ALSO".IX Header "SEE ALSO"\&\fI\fIpthread_attr_init()\fI\fR,\&\fI\fIpthread_attr_setdetachstate()\fI\fR,\&\fI\fIpthread_attr_setstacksize()\fI\fR,\&\fI\fIpthread_create()\fI\fR,\&\fI<limits.h\fR>,\&\fI<pthread.h\fR>..SH "_\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|_".IX Header "______________________________________________________________________".SH "NAME"\&\fBpthread_attr_setstacksize,\fR \fBpthread_attr_getstacksize\fR\&\- set and get stacksize attribute.SH "SYNOPSIS".IX Header "SYNOPSIS"#include <pthread.h>.PPint pthread_attr_setstacksize(pthread_attr_t *\fIattr\fR, size_t \fIstacksize\fR);int pthread_attr_getstacksize(const pthread_attr_t *\fIattr\fR,size_t *\fIstacksize\fR);.SH "DESCRIPTION".IX Header "DESCRIPTION"The functions\&\fI\fIpthread_attr_setstacksize()\fI\fRand\&\fI\fIpthread_attr_getstacksize()\fI\fR,respectively, set and get the thread creation\&\fIstacksize\fRattribute in the\&\fIattr\fRobject..PPThe\&\fIstacksize\fRattribute defines the minimum stack size (in bytes) allocated forthe created threads stack..SH "RETURN VALUE".IX Header "RETURN VALUE"Upon successful completion,\&\fI\fIpthread_attr_setstacksize()\fI\fRand\&\fI\fIpthread_attr_getstacksize()\fI\fRreturn a value of 0.Otherwise, an error number is returned to indicate the error.The\&\fI\fIpthread_attr_getstacksize()\fI\fRfunction stores the\&\fIstacksize\fRattribute value in\&\fIstacksize\fRif successful..SH "ERRORS".IX Header "ERRORS"The\&\fI\fIpthread_attr_setstacksize()\fI\fRfunction will fail if:.IP "[\s-1EINVAL\s0]" 4.IX Item "[EINVAL]"The value of\&\fIstacksize\fRis less than \s-1PTHREAD_STACK_MIN\s0 or exceeds a system-imposed limit..PPThese functions will not return an error code of [\s-1EINTR\s0]..SH "EXAMPLES".IX Header "EXAMPLES"None..SH "APPLICATION USAGE".IX Header "APPLICATION USAGE"None..SH "FUTURE DIRECTIONS".IX Header "FUTURE DIRECTIONS"None..SH "SEE ALSO".IX Header "SEE ALSO"\&\fI\fIpthread_attr_init()\fI\fR,\&\fI\fIpthread_attr_setstackaddr()\fI\fR,\&\fI\fIpthread_attr_setdetachstate()\fI\fR,\&\fI\fIpthread_create()\fI\fR,\&\fI<limits.h\fR>,\&\fI<pthread.h\fR>..SH "_\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|__\|_".IX Header "______________________________________________________________________".SH "NAME"\&\fBpthread_attr_init,\fR \fBpthread_attr_destroy\fR\&\- initialise and destroy threads attribute object.SH "SYNOPSIS".IX Header "SYNOPSIS"#include <pthread.h>.PPint pthread_attr_init(pthread_attr_t *\fIattr\fR);int pthread_attr_destroy(pthread_attr_t *\fIattr\fR);.SH "DESCRIPTION".IX Header "DESCRIPTION"The function\&\fI\fIpthread_attr_init()\fI\fRinitialises a thread attributes object\&\fIattr\fRwith the default value for all of the individual attributesused by a given implementation..PPThe resulting attribute object(possibly modified by setting individual attribute values),when used by\&\fI\fIpthread_create()\fI\fR,defines the attributes of the thread created.A single attributes object can be used in multiple simultaneous calls to\&\fI\fIpthread_create()\fI\fR..PPThe\&\fI\fIpthread_attr_destroy()\fI\fR

⌨️ 快捷键说明

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