Signals and multiple tasks created by pthread_create

The pthread_create service creates dubbed tasks within the process. This section describes how signals work in processes that have multiple dubbed tasks created by the pthread_create service and ATTACH system service.

A thread created by pthread_create also inherits any signal setup information created by a prior mvssigsetup call. If the caller of pthread_create had previously called mvssigsetup successfully, the thread created is also set up for signals. The mvssigsetup and pthread_create services can be used to create multiple threads in a process that is set up for signals.

When a signal is generated by a kill service request to a process that has multiple threads set up for signals and threads that are not set up for signals, z/OS UNIX signal processing must determine which thread has the most interest in the signal. The signal is delivered to the thread with the most interest when a signal catcher is defined by a sigaction call.

The following is a list of signal interest rules for a signal generated by a kill call from most to least interested:
  1. When threads are found in a sigwait for this signal, the signal is delivered to the first thread found in a sigwait.
  2. When all threads are blocking this signal, the signal is left pending at the process level. The sigpending service moves blocked pending signals at the process level to the thread-level.
  3. When the default terminating signal action (not ignore and not catch) is to take place, that action is performed for all threads in the process.
  4. When all of the following are true:
    • One or more threads are set up for signals.
    • All threads set up for signals have the signal blocked.
    • A thread not set up for signals has not blocked the signal.
    The signal is left pending on the first thread set up for signals. This signal remains pending on that thread until the thread unblocks the signal.
  5. When one or more threads are set up for signals and at least one of the threads set up for signals has the signal unblocked, the signal is delivered to the first thread that is set up for signals that also has the signal unblocked.