pthread_detach (BPX1PTD, BPX4PTD) — Detach a thread
Function
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.
Requirements
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. |
Format
|
AMODE 64 callers use BPX4PTD with the same parameters.
Parameters
- Thread_ID
- Supplied parameter
- Type:
- Character string
- Length:
- 8 bytes
The name of an 8-byte field that contains the thread ID for the thread that is to be detached.
- Return_value
- Returned parameter
- Type:
- Integer
- Length:
- Fullword
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
- Returned parameter
- Type:
- Integer
- Length:
- Fullword
The name of a fullword in which the pthread_detach service stores the return code. The pthread_detach service returns Return_code only if Return_value is -1. For a complete list of possible return code values, see z/OS UNIX System Services Messages and Codes. The pthread_detach service can return one of the following values in the Return_code parameter: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. - Reason_code
- Returned parameter
- Type:
- Integer
- Length:
- Fullword
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.
Related services
Characteristics and restrictions
There are no restrictions on the use of the pthread_detach service.
Examples
For an example using this callable service, see BPX1PTC (pthread_create) example.