cmultithreadingreturnpthreadspthread-exit

Thread termination with pthread_exit followed by return - Strange example


I found this example; here the two threads threadDefault and threadCustomized are terminated by using pthread_exit followed by return. Why did the author write both instructions?


Solution

  • Mohith Reddy's answer is correct but misses the point. Of course the return statement is never executed since pthread_exit doesn't return, but it's there to suppress warnings from the compiler in case it's not aware that pthread_exit doesn't return.