The pthread_create task initialization routine

The first routine that is given control in the new task when a thread is created with the pthread_create service is the pthread_create pthread-creating task initialization routine. (The pthread-creating task initialization routine is not the same as the initial pthread-creating task (IPT). The pthread-creating task initialization routine is the routine that is given control when a pthread_create is done, whereas the IPT refers to the task that the first task runs on.) The pthread_create pthread-creating task initialization routine does the following:
  1. Acquires task-related resources required by the user application.
  2. Calls pthread_exit_and_get service to exit the old thread and get the new thread information. The exit of the old thread is ignored if this is the first call to pthread_exit_and_get.
  3. Checks for failures. If a failure is found, it skips to step 8.
  4. Gets pthread-related resources for the newly created thread.
  5. Calls the user-specified Start_routine.
  6. Releases resources for the newly created thread.
  7. Repeats step 2.
  8. Releases task-related resources.
  9. Returns to the caller (ends the task).
Note: When control is returned after a successful pthread_exit_and_get call, the thread can be interrupted by any signals that are not blocked. The signal blocking mask of the created thread is inherited from the thread that invoked the created thread.