Suppose I have a declared pthread_t struct, like the following:
pthread_t newThread;
And then I call:
pthread_join(&newThread, NULL, myMethod, NULL);
What will pthread_join() do?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
According to ISO C, the
newThreadvariable is an “indeterminately valued object”, the use of which triggers undefined behavior. It could have a “trap representation” which triggers a CPU exception.Or it may just be interpreted as a random value of that type, which the API could handle in one of two ways: either there is no such thread, and
ESRCHis returned, or by fluke there is such a thread. Then various cases arise: is it joinable or not, etc.