Why cannot I directly compare 2 thread ids instead of using pthread_equal?
问题 I know there is a system call pthread_equal in Linux for comparing 2 thread ids. But why cannot one directly compare 2 thread ids using '==' operator? 回答1: From the pthread_equal man page on Linux: The pthread_equal() function is necessary because thread IDs should be considered opaque: there is no portable way for applications to directly compare two pthread_t values. It might be a struct. It might be a pointer. It might be a pointer to a struct held somewhere. == might, or might not, return