The pthread_detach callable service detaches a thread in the calling process. When a thread is detached, its system storage can be reclaimed when the thread exits.
Operation | Environment |
---|---|
Authorization: | Supervisor state or problem state, any PSW key |
Dispatchable unit mode: | Task |
Cross memory mode: | PASN = HASN |
AMODE (BPX1PTD): | 31-bit |
AMODE (BPX4PTD): | 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 BPX4PTD with the same parameters.
The name of an 8-byte field that contains the thread ID for the thread that is to be detached.
The name of a fullword in which the pthread_detach service returns 0 if the request is successful, or -1 if it is not successful.
Return code | Explanation |
---|---|
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: JRLightWeightThid. |
ESRCH | The system has detected that the value that was specified by thread ID refers to a thread that is already detached or that cannot be found. The following reason codes can accompany this return code: JRThreadNotFound and JRAlreadyDetached. |
The name of a fullword in which the pthread_detach service stores the reason code. The pthread_detach 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_detach service.
For an example using this callable service, see BPX1PTC (pthread_create) example.