The pthread_join callable service obtains the termination status for a specific thread. The pthread_join service waits only if the thread has not ended, is not in a detached state, and is not currently joined by another thread.
Operation | Environment |
---|---|
Authorization: | Supervisor state or problem state, any PSW key |
Dispatchable unit mode: | Task |
Cross memory mode: | PASN = HASN |
AMODE (BPX1PTJ): | 31-bit |
AMODE (BPX4PTJ): | 64-bit |
ASC mode: | Primary mode |
Interrupt status: | Enabled for interrupts |
Locks: | Unlocked |
Control parameters: | All parameters must be addressable by the caller and in the primary address space. |
|
AMODE 64 callers use BPX4PTJ with the same parameters. The Status_field_address parameter is a doubleword.
The name of an 8-byte field that contains the thread ID for the target thread that is to be waited upon.
The name of a fullword (doubleword) field that contains the address of a status field in which to return the exit status of the thread that is specified by the thread ID value. If this field is zero, the thread exit status is not returned.
The name of a fullword in which the pthread_join service returns 0 if the request is successful, or -1 if it is not successful.
Return code | Explanation |
---|---|
EINTR | The calling process received a signal before the completion of an event that would cause the pthread_join service to return. The service was interrupted by a signal. In this case, the value contained in Status_field_address is undefined. |
EINVAL | The value that was specified by thread ID is not valid; it does not contain a value that is consistent with thread IDs managed by the system. The following reason code can accompany this return code: JRLightWeightThread. |
ESRCH | The value that was specified by thread ID does not refer to a thread that is undetached. The following reason codes can accompany this return code: JRThreadNotFound, JRAlreadyJoined, and JRAlreadyDetached. |
EDEADLK | A deadlock was detected; or the value specified by thread ID refers to the calling thread. The following reason codes can accompany this return code: JRJoinLoop and JRJoinToSelf. |
The name of a fullword in which the pthread_join service stores the reason code. The pthread_join service returns Reason_code only if Return_value is -1. Reason_code further qualifies the Return_code value. For the reason codes, see z/OS UNIX System Services Messages and Codes.
There are no restrictions on the use of the pthread_join service.
For an example using this callable service, see BPX1PTJ (pthread_join) example.