Hi i have create a POSIX thread and trying to pring thread id through pthread_self(), when i print that with %d or %ld, i am getting the negative value?.. what is the workaround for this issue?. My linux version is 2.6.22-14-server.
Pthread ids are long unsigned int, while %d is for signed ints. Try using %u instead or %lu.
pthread_t is an opaque type. Expect anything that tries to manipulate it directly (e.g. by passing it as an argument to printf) to break.
Pthread ids are long
Pthread ids are long unsigned int, while %d is for signed ints. Try using %u instead or %lu.
pthread_t is an opaque type.
pthread_t is an opaque type. Expect anything that tries to manipulate it directly (e.g. by passing it as an argument to printf) to break.