慢性肾功能不全是什么意思| 白皮书是什么意思| 女人叫床最好喊什么| 7到9点是什么时辰| 什么是鸡冠油| 酒后手麻什么原因| 心脏早搏有什么危险| 什么他妈的叫他妈的惊喜| 出现的反义词是什么| 职业年金有什么用| 子宫动脉阻力高是什么引起的| 尿道口为什么叫马眼| 纵隔是什么意思| 导盲犬一般是什么品种| 莱字五行属什么| 拉屎很臭是什么原因| 恢复是什么意思| 什么的大象| a216是什么材质| 早餐应该吃什么| 吃什么东西能通便| 泰山山顶叫什么| 缺铁性贫血吃什么药最好| 梦见虱子是什么意思| 佛跳墙是什么菜| 低密度灶是什么意思| 菠菜不能与什么一起吃| kappa属于什么档次| 乳头内陷挂什么科| 双抗是什么药| 女孩什么时辰出生最好| 94年的属什么| 门昌念什么| a型血的人容易得什么病| 标准差是什么| 两个人在一起的意义是什么| happy halloween是什么意思| 什么是考生号| 栉风沐雨是什么意思| 掉眉毛是什么原因| 虎父无犬女是什么意思| 为什么人一瘦就会漂亮| 血管是什么组织| 红色的蛇是什么蛇| ocg是什么意思| pdi是什么| 表述是什么意思| 苍苍什么| 缠腰蛇是什么原因引起的| 老想放屁是什么原因| 血糖低会出现什么症状| 吃什么指甲长得快| 兔肉不能和什么一起吃| 小猫为什么一直叫| 锚什么意思| 坐围是什么| 什么是梅尼埃综合症| imax是什么| blood什么意思| 一般细菌涂片检查是查什么| 2026年是什么命| 属猪本命佛是什么佛| 胰岛素针头4mm和5mm有什么区别| 什么快递最便宜| 易胖体质是什么原因造成的| 什么杯子喝水最健康| 暗渡陈仓是什么生肖| 骨质欠规整是什么意思| 值机是什么意思| 记性越来越差是什么原因| 锁骨是什么骨| 什么叫玄学| 乳房钙化灶是什么意思| 热伤风吃什么药| 风热是什么意思| 锐步是什么档次| 3.8号是什么星座| 脓包疮用什么药| 知了叫什么| 江米和糯米有什么区别| 苗子是什么意思| 百香果吃了有什么好处| 梦见到处都是蛇预示着什么| 胆囊炎吃什么好| 改朝换代是什么意思| 女人吃人参有什么好处| 人参和什么泡酒壮阳| 巾帼指什么| 咦惹是什么意思| 河蚌用什么呼吸| 嗯呢是什么意思| 心血不足吃什么药| 反馈是什么意思| 洗劫一空是什么意思| oct试验是什么| 嗓子哑了吃什么药好| 泸州老窖是什么香型| c蛋白反应高是什么原因| 波奇饭是什么意思| 运是什么意思| 尿中有泡沫是什么原因| 孕妇吃辣椒对胎儿有什么影响| 吃什么能增强记忆力| 结婚40年是什么婚| 成群结队是什么意思| 鹅口疮是什么原因引起的| 梦见自己家盖房子是什么预兆| 外阴瘙痒用什么效果好| 糖尿病吃什么菜最好| tid什么意思| 胎盘可以治什么病| 宫颈筛查是什么| 冒虚汗是什么原因| 为什么会打喷嚏| 莘字五行属什么| 甲木命是什么意思| 职别是什么意思| 眼睛胀是什么原因| 为什么不能空腹喝豆浆| 三文鱼配什么酒| 同工同酬什么意思| 膝盖疼挂号挂什么科| 看甲状腺去医院挂什么科| 屁股出汗多是什么原因| 什么样的月光| 玫瑰代表什么| 脑萎缩是什么原因| 杨紫属什么生肖| 阑尾炎不能吃什么食物| 甲亢吃什么盐好| 2021是什么年| 子女缘薄是什么意思| 冬瓜吃了有什么好处| 高血压挂号要挂什么科| 鄂尔多斯为什么叫鬼城| 我不知道你在说什么英文| 伊拉克是什么人种| 心脏由什么组织构成| 天珠是什么做的| 什么弟什么兄| 赡养什么意思| 尿素是什么肥料| 什么是沉香| 嘴唇淡紫色是什么原因| 什么车最长| 女人湿气太重喝什么茶| 早泄吃什么药| 印度人为什么不吃猪肉| 茯苓是什么东西| 鱼工念什么| 角头是什么意思| 变态反应是什么意思| 什么可以解酒最快方法| 亦如是什么意思| 居士是什么意思| 白砂糖和冰糖有什么区别| 可字属于五行属什么| 吃饭老是噎着是什么原因| 拆台是什么意思| 山药有什么营养| 气血不足吃什么东西| 一个三点水一个令念什么| 胃窦炎是什么症状| 决明子有什么功效| 煞科什么意思| 口若悬河是什么意思| 天蝎座是什么性格| 扁的桃子叫什么名字| 做梦梦到地震预示着什么| 阿司匹林治疗什么病| 麦乳精是什么| 奶思是什么意思| 脸发红发痒是什么原因| 俄罗斯的货币叫什么| 糖尿病能吃什么零食| hp感染是什么意思| 脑部ct挂什么科| 胃烧心吃什么食物好| 酸菜鱼用什么鱼| 心脏有个小洞叫什么病| 软助什么意思| 4月3日是什么星座| 长期口苦是什么原因| 大便成细条状是什么病| 脖子出汗多是什么原因女人| 审阅是什么意思| 干什么| 手淫什么意思| 怀孕做nt检查什么| o型血为什么叫熊猫血| 乳腺癌长在什么位置| 中分化是什么意思| 阴道炎有什么症状| phc是什么意思| 蹦蹦跳跳的动物是什么生肖| 爱困总想睡觉什么原因| 阴道里面长什么样| 口臭舌苔白厚吃什么药| 馋肉是身体里缺什么| 促排药什么时候开始吃| 爽约什么意思| Polo什么意思| 蜱虫咬人后有什么症状| 孩子呕吐吃什么药| 低压高是什么意思| 吃什么补钾最快| 帕金森病是什么症状| 梦到抓鱼是什么意思| 一级警长是什么级别| 唐朝灭亡后是什么朝代| 炖肉什么时候放盐| 王维被称为什么| 推什么出什么| 半夜两点是什么时辰| 父母都是a型血孩子是什么血型| 脚心抽筋是什么原因引起的| 牙杀完神经为什么还疼| 尿频尿急是什么原因| 宝妈是什么意思| 鹿沼土是什么土| 小猫吃什么食物| 什么拉车连蹦带跳歇后语| 眼睛干涩模糊用什么眼药水| 牛跟什么生肖相合| x58主板配什么cpu| 外阴有白色的东西是什么| 211和985什么意思| 还珠格格什么时候上映的| 治疗心率过快用什么药效果好| 覆盖是什么意思| 屋里有蝙蝠有什么预兆| notebook是什么意思| 明油是什么油| 肝多发小囊肿什么意思| 缺钾最明显的症状是什么| 什么人一年只工作一天脑筋急转弯| 蛞蝓是什么| darling什么意思| 淋巴结钙化是什么意思| 心情沉重是什么意思| 吃晕车药有什么副作用| 海石花是什么| 最大的沙漠是什么沙漠| 厥是什么意思| 具象是什么意思| 蒙古古代叫什么| 红细胞计数偏低是什么意思| 胃肠镜能检查出什么病| 梦房子倒塌什么预兆| 神仙眷侣是什么意思| 耳洞为什么会发臭| 杳什么意思| 深棕色是什么颜色| 血糖低吃什么药| 08年属什么生肖| 盐酸利多卡因是什么药| 惊厥是什么病| 狗狗打疫苗前后要注意什么| 上海最高楼叫什么大厦有多少米高| 为什么叫六小龄童| 新生儿什么时候可以喝水| 乌云为什么是黑色的| 陈皮泡水喝有什么功效| 胸口容易出汗是什么原因| 百度
The Open Group Base Specifications Issue 8
IEEE Std 1003.1-2024
Copyright ? 2001-2024 The IEEE and The Open Group

NAME

threads.h — ISO C threads

SYNOPSIS

#include <threads.h>

DESCRIPTION

[CX] [Option Start] The functionality described on this reference page is aligned with the ISO C standard. Any conflict between the requirements described here and the ISO C standard is unintentional. This volume of POSIX.1-2024 defers to the ISO C standard.

Implementations shall not define the macro __STDC_NO_THREADS__, except for profile implementations that define _POSIX_SUBPROFILE (see 2.1.5.1 Subprofiling Considerations) in <unistd.h>, which may define __STDC_NO_THREADS__ and, if they do so, need not provide this header nor support any of its facilities. [Option End]

The <threads.h> header shall define the following macros:

thread_local
Expands to _Thread_local.
ONCE_FLAG_INIT
Expands to a value that can be used to initialize an object of type once_flag.
TSS_DTOR_ITERATIONS

Expands to an integer constant expression representing the maximum number of times that destructors will be called when a thread terminates and shall be suitable for use in #if preprocessing directives.

[CX] [Option Start] If {PTHREAD_DESTRUCTOR_ITERATIONS} is defined in <limits.h>, the value of TSS_DTOR_ITERATIONS shall be equal to {PTHREAD_DESTRUCTOR_ITERATIONS}; otherwise, the value of TSS_DTOR_ITERATIONS shall be greater than or equal to the value of {_POSIX_THREAD_DESTRUCTOR_ITERATIONS} and shall be less than or equal to the maximum positive value that can be returned by a call to sysconf(_SC_THREAD_DESTRUCTOR_ITERATIONS) in any process. [Option End]

The <threads.h> header shall define the types cnd_t, mtx_t, once_flag, thrd_t, and tss_t as complete object types, the type thrd_start_t as the function pointer type int (*)(void*), and the type tss_dtor_t as the function pointer type void (*)(void*). [CX] [Option Start] The type thrd_t shall be defined to be the same type that pthread_t is defined to be in <pthread.h>. [Option End]

The <threads.h> header shall define the enumeration constants mtx_plain, mtx_recursive, mtx_timed, thrd_busy, thrd_error, thrd_nomem, thrd_success and thrd_timedout.

The following shall be declared as functions and may also be defined as macros. Function prototypes shall be provided.

void            call_once(once_flag *, void (*)(void));
int             cnd_broadcast(cnd_t *);
void            cnd_destroy(cnd_t *);
int             cnd_init(cnd_t *);
int             cnd_signal(cnd_t *);
int             cnd_timedwait(cnd_t * restrict, mtx_t * restrict,
                    const struct timespec * restrict);
int             cnd_wait(cnd_t *, mtx_t *);
void            mtx_destroy(mtx_t *);
int             mtx_init(mtx_t *, int);
int             mtx_lock(mtx_t *);
int             mtx_timedlock(mtx_t * restrict,
                    const struct timespec * restrict);
int             mtx_trylock(mtx_t *);
int             mtx_unlock(mtx_t *);
int             thrd_create(thrd_t *, thrd_start_t, void *);
thrd_t          thrd_current(void);
int             thrd_detach(thrd_t);
int             thrd_equal(thrd_t, thrd_t);
_Noreturn void  thrd_exit(int);
int             thrd_join(thrd_t, int *);
int             thrd_sleep(const struct timespec *, struct timespec *);
void            thrd_yield(void);
int             tss_create(tss_t *, tss_dtor_t);
void            tss_delete(tss_t);
void           *tss_get(tss_t);
int             tss_set(tss_t, void *);

Inclusion of the <threads.h> header shall make symbols defined in the header <time.h> visible.


The following sections are informative.

APPLICATION USAGE

The <threads.h> header is optional in the ISO C standard but is mandated by POSIX.1-2024. Note however that subprofiles can choose to make this header optional (see 2.1.5.1 Subprofiling Considerations), and therefore application portability to subprofile implementations would benefit from checking whether __STDC_NO_THREADS__ is defined before inclusion of <threads.h>.

The features provided by <threads.h> are not as extensive as those provided by <pthread.h>. It is present on POSIX.1 implementations in order to facilitate porting of ISO C programs that use it. It is recommended that applications intended for use on POSIX.1 implementations use <pthread.h> rather than <threads.h> even if none of the additional features are needed initially, to save the need to convert should the need to use them arise later in the application's lifecycle.

RATIONALE

Although the <threads.h> header is optional in the ISO C standard, it is mandated by POSIX.1-2024 because <pthread.h> is mandatory and the interfaces in <threads.h> can easily be implemented as a thin wrapper for interfaces in <pthread.h>.

The type thrd_t is required to be defined as the same type that pthread_t is defined to be in <pthread.h> because thrd_current() and pthread_self() need to return the same thread ID when called from the initial thread. However, these types are not fully interchangeable (that is, it is not always possible to pass a thread ID obtained as a thrd_t to a function that takes a pthread_t, and vice versa) because threads created using thrd_create() have a different exit status than pthreads threads, which is reflected in differences between the prototypes for thrd_create() and pthread_create(), thrd_exit() and pthread_exit(), and thrd_join() and pthread_join(); also, thrd_join() has no way to indicate that a thread was cancelled.

The standard developers considered making it implementation-defined whether the types cnd_t, mtx_t and tss_t are interchangeable with the corresponding types pthread_cond_t, pthread_mutex_t and pthread_key_t defined in <pthread.h> (that is, whether any function that can be called with a valid cnd_t can also be called with a valid pthread_cond_t, and vice versa, and likewise for the other types). However, this would have meant extending mtx_lock() to provide a way for it to indicate that the owner of a mutex has terminated (equivalent to [EOWNERDEAD]). It was felt that such an extension would be invention. Although there was no similar concern for cnd_t and tss_t, they were treated the same way as mtx_t for consistency. See also the RATIONALE for mtx_lock() concerning the inability of mtx_t to contain information about whether or not a mutex supports timeout if it is the same type as pthread_mutex_t.

FUTURE DIRECTIONS

None.

SEE ALSO

<limits.h>, <pthread.h>, <time.h>

XSH 2.9 Threads, call_once(), cnd_broadcast(), cnd_destroy(), cnd_timedwait(), mtx_destroy(), mtx_lock(), sysconf(), thrd_create(), thrd_current(), thrd_detach(), thrd_equal() , thrd_exit(), thrd_join(), thrd_sleep(), thrd_yield(), tss_create(), tss_delete(), tss_get()

CHANGE HISTORY

First released in Issue 8. Included for alignment with the ISO/IEC 9899:2018 standard.

End of informative text.

 

return to top of page

UNIX? is a registered Trademark of The Open Group.
POSIX? is a Trademark of The IEEE.
Copyright ? 2001-2024 The IEEE and The Open Group, All Rights Reserved
[ Main Index | XBD | XSH | XCU | XRAT ]

第一次是什么感觉 12朵玫瑰代表什么意思 检查尿液能查出什么病 扁桃体发炎是什么原因 什么症状吃藿香清胃胶囊
蛇酒不是三十九开什么 爰是什么意思 果脯是什么东西 瞿读什么 梦见朋友死了是什么意思
什么马奔腾 6月9日什么星座 血小板分布宽度偏低是什么意思 天蝎座和什么星座配 决定的近义词是什么
尿常规3个加号什么意思 六月十八是什么星座 刮痧不出痧是什么原因 肺积水是什么原因引起的 蚂蚱吃什么食物
爸爸的爸爸叫什么wuhaiwuya.com 冰粉是什么hcv9jop8ns0r.cn 痰饮是什么意思hcv9jop2ns6r.cn 大便失禁是什么原因chuanglingweilai.com 黑色皮肤适合什么颜色的衣服hcv7jop9ns4r.cn
小腹痛男性什么原因hcv8jop2ns7r.cn 点解是什么意思hcv9jop7ns0r.cn 内页是什么意思huizhijixie.com 化是什么意思hcv9jop3ns6r.cn 火星是什么颜色hcv8jop4ns3r.cn
阳春三月是什么生肖hcv8jop9ns8r.cn 双侧胸膜增厚是什么意思hcv7jop6ns8r.cn 什么是二代身份证hcv8jop7ns1r.cn 常喝枸杞泡水有什么好处hcv7jop7ns1r.cn 做梦梦到怀孕了是什么意思hcv9jop8ns2r.cn
阴瑜伽是什么意思hcv9jop1ns5r.cn 包皮是什么hcv7jop4ns6r.cn 什么叫桑黄hcv9jop1ns9r.cn benny是什么意思hcv9jop6ns0r.cn 半月板后角变性什么意思hcv8jop8ns5r.cn
百度