Question: Have the main function in your program first print out a line identifying itself as main and giving the PID of the process and the
Have the main function in your program first print out a line identifying itself as main and giving the PID of the process and the TID (thread identifier) of the first thread, the only thread at this point. (A thread can use pthread_self to get its TID.) Then have your main function create a second thread. The function that you start the second thread in (see note [2], below) needs to have only a single line of code that just prints out a simple "Hi, I'm the second thread" message with its PID and TID (PID will be the same of course, you won't have created a new process, just a new thread). Have the main thread check for success in creating the second thread, and, if successful, have main print out the thread identifier (TID) of the new (second) thread. Do not use a pthread_join call (yet).
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
