Using pthread_exit_and_get when the thread is not the IPT and not the last thread

Table 1 describes the actions that are taken when pthread_exit_and_get is issued on a thread that is not the IPT and is not the last thread.

Table 1. Using pthread_exit_and_get when the thread is not the IPT and not the last thread
Step Thread 1 (initial pthread-creating task, or IPT) Thread 2 (pthread-created thread)
1   A request to exit the pthread is issued.
2   Run thread cleanup routines before terminating this thread.
3   Return to the pthread-creating task initialization routine that issued pthread_exit_and_get to terminate the thread, using the PTEXITTHREAD and PTGETNEWTHREAD option for MWTs or the PTEXITTHREAD option for HWTs. If you want to know when the last thread is terminating so that process termination cleanup can be done first, specify PTFAILIFLASTTHREAD. You must then call pthread_exit_and_get again, but this time without the PTFAILIFLASTTHREAD option.
4   For MWTs, this task waits in the kernel until the next new pthread_create request. When pthread_exit_and_get returns a -1 return value, a new thread was not created. You must exit the pthread-creating task initialization routine, terminating the task. (You must always do this for HWTs.)
5   A successful return from pthread_exit_and_get indicates that this was not the last thread that terminated. If the PTEXITTHREAD and PTGETNEWTHREAD option was used, a new thread was returned.