Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Datatype of pthread_t in pthreads?

Tags:

c

64-bit

pthreads

I have a code in 32 bit in which int is used in place of pthread_t ? so while porting do i need to change to long in LP64 (64 bit). What is the datatype of pthread_t ?

like image 851
PGP Avatar asked Dec 20 '22 05:12

PGP


2 Answers

pthread_t is an implementation defined type; no assumption should be made on its underlying type.

POSIX.1-2008 adds that:

IEEE Std 1003.1-2001/Cor 2-2004, item XBD/TC2/D6/26 is applied, adding pthread_t to the list of types that are not required to be arithmetic types, thus allowing pthread_t to be defined as a structure.

like image 127
ouah Avatar answered Jan 09 '23 18:01

ouah


Use pthread_t like you are supposed to. Done.

like image 36
Jonathon Reinhart Avatar answered Jan 09 '23 18:01

Jonathon Reinhart