Ending threads

A thread is a stream of computer instructions that is in control of a process. Several threads can run concurrently, performing different jobs. An operator can use the MODIFY command to end a thread without disrupting the entire process. The syntax is:
F BPXOINIT,{TERM}=pid[.tid]
           {FORCE}
where
  • pid indicates the process identifier (PID) of the thread to be ended. The PID is specified in decimal form as displayed by the D OMVS command.
  • tid indicates the thread identifier (TID) of the thread to be ended. The TID is 16 hexadecimal (0-9,A-F) characters as displayed by the following command:
    D OMVS,PID=pppppppp
  • TERM= indicates the signal interface routine will be allowed to receive control before the thread is ended.
  • FORCE= indicates the signal interface routine will not be allowed to receive control before the thread is ended.

    Although abnormal termination of a thread typically causes a process to end, using the MODIFY command to end a thread will not cause the process to end.

You will typically want to end a single thread when the thread represents a single user in a server address space. Otherwise, random termination of threads can cause some processes to hang or fail. If a thread in a process is hung, use the MODIFY operator command to terminate the thread without ending the entire process. Use the TERM keyword first. If that does not succeed, then use FORCE. For example:
  • To allow the signal interface routine to receive control before the thread is ended:
    F BPXOINIT,TERM=pppppppp.tttttttttttttttt
    where pppppppp is the process identifier and tttttttttttttttt is the thread identifier.
  • To end the thread without allowing the signal interface routine to receive control:
    F BPXOINIT,FORCE=pppppppp.tttttttttttttttt
    where pppppppp is the process identifier and tttttttttttttttt is the thread identifier.