C函数篇(pthread_t结构)

本文详细对比了Linux与Windows操作系统下pthread_t类型的定义差异。Linux中,pthread_t被定义为unsigned long int;而在Windows下,pthread_t则是一个包含指向实际对象指针和额外信息的结构体类型。这些细节对于理解跨平台线程编程具有重要意义。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

linux下是这样定义的:

在linux的实现中pthread_t被定义为 "unsigned long int",参考http://condor.depaul.edu/glancast/443class/docs/pthreads.html


Windows下这样定义:

 1 /*  
 2  * Generic handle type - intended to extend uniqueness beyond  
 3  * that available with a simple pointer. It should scale for either  
 4  * IA-32 or IA-64.  
 5  */    
 6 typedef struct {    
 7     void * p;                   /* Pointer to actual object */    
 8     unsigned int x;             /* Extra information - reuse count etc */    
 9 } ptw32_handle_t;    
10 typedef ptw32_handle_t pthread_t;   

转载于:https://www.cnblogs.com/sky-of-chuanqingchen/p/4123413.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值