Thread ID vs pthread handle (pthread_t)

Source: Internet
Author: User

In the case of multi-threaded implementation, pthread_t is used as the abstract type and is specified as the whole line with a length of 4 as the thread ID.

In the thread implementation of some iseries servers, the thread ID is a 64-bit integer value and pthread_t is an abstract

The struct contains values and some other parameters. Abstraction allows a process to accommodate thousands of threads.

 

If transplantation is not allowed, processes are not allowed to access the internal data and size of pthread_t, such as comparing thread IDs,

Use the pthread_equal function. This document usually describes pthread_t as the thread handle. Avoid using an integer to represent the thread ID.

While obfuscation,

Thread ID vs. pthread handle (pthread_t)

 

In bytes 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

Role action (structure) that contains thatvalue and others. This role action 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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.