码迷,mamicode.com
首页 > 其他好文 > 详细

Thread ID vs Pthread Handle(pthread_t)

时间:2014-09-08 11:00:07      阅读:576      评论:0      收藏:0      [点我收藏+]

标签:abstract   服务器   thread   结构体   多线程   

在很多线程实现的案例中,pthread_t作为抽象类型,被指定为长度为4的整行作为线程ID

在一些iSeries服务器的线程实现上,线程ID是一个64位的整型数值和pthread_t是一个抽象

的结构体包含数值和一些其他的参数。抽象化允许进程容纳上千个线程。

 

如果不允许移植,不允许进程访问pthread_t的内部数据和尺寸,例如对比线程ID,对于可移植的对比,

使用pthread_equal函数。文档通常描述pthread_t作为线程句柄,避免因为使用一个整型表示线程ID

而混淆概念,

Thread ID vs. Pthread Handle (pthread_t)

 

In many threads implementations, thepthread_t abstract type is implemented as an integer (4 byte) thread ID.

In the iSeries implementation of Pthreads,the thread ID is a 64-bit integral value and the pthread_t is an

abstraction (structure) that contains thatvalue and others.This abstraction helps to allow the implementation

 toscale to thousands of threads in a process.

 

Do not allow your program to rely on theinternal structure or size of the pthread_t in a non-portable fashion,

 suchas comparisons of thread IDs. For portable comparison, use the pthread_equal()API. This documentation

occasionally refers to the pthread_t as aPthread handle to try to prevent the misconception that

it represents a single integer value.

Thread ID vs Pthread Handle(pthread_t)

标签:abstract   服务器   thread   结构体   多线程   

原文地址:http://5228690.blog.51cto.com/5218690/1549824

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!