The MVSThreadAffinity callable service allows a task created with pthread_create to request that a user-defined assembler routine is to be run on a specified target pthread. The requesting and target pthread must have been created with pthread_create, and both threads must be under the same initial pthread-creating thread (IPT). The requesting pthread is blocked until the requested routine has been run. The target pthread may be the IPT.
This service provides the ability for a program to manage MVS™ resources under the target pthread or IPT, instead of under the requesting pthread. Resources that can be managed with this service include load modules, opened data sets, and other MVS resources with task affinity.
Operation | Environment |
---|---|
Authorization: | Supervisor state or problem state, any PSW key |
Dispatchable unit mode: | Task |
Cross memory mode: | PASN = HASN |
AMODE (BPX1TAF): | 31-bit |
AMODE (BPX4TAF): | 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 BPX4TAF with the same parameters. Routine_address and Parameter_list are 64-bit pointer fields.
The name of a fullword (doubleword) containing the address of the routine to which control is to be passed on the target pthread. The requesting pthread is responsible for ensuring that the routine to be run is in memory when it is called, and remains there until the call is complete.
The name of a fullword (doubleword) that contains the address of the routine parameter list. The value in this fullword is passed in register 1 when the specified routine receives control. If the routine does not require parameters, specify 0.
The name of an 8-byte field that contains the target pthread under which the routine is to run. This is the value returned by the pthread_self service, or pointed to by the PTXL field PTXLTHIDPTR provided by the pthread_exit_and_get service. (See BPXYPTXL — Map the parameter list for pthread_create.) A value of all zeros will target the IPT.
The name of a fullword in which the MVSThreadAffinity service returns 0 if the request completes successfully, or -1 if the request is not successful.
The name of a fullword in which the MVSThreadAffinity service stores the return code. The MVSThreadAffinity service returns Return_code only if Return_value is -1. See z/OS UNIX System Services Messages and Codes for a complete list of possible return code values. The MVSThreadAffinity service can return one of the following values in the Return_code parameter:
Return_code | Explanation |
---|---|
EFAULT | A bad address was received as an argument of the call; or the specified routine experienced an abnormal end or program check that was not handled by the routine's recovery. Consult Reason_code to determine the exact reason the error occurred. The following reason codes can accompany the return code: JRBadAddress and JRRoutineError. |
EAGAIN | Another pthread within the process has this call pending for the specified pthread. At most one pthread can request this service at a time for a given pthread. The requesting pthread can try again later when the current pending call is complete. |
EACESS | A task other than a pthread-created task or IPT is not permitted to perform this service. |
EINVAL | A thread with the specified thread ID was not found. The reason code accompanying this return code is JRThreadNotFound. |
EMVSERR | The passed Routine_address is zero or greater than X'7FFFFFFF'. The reason code accompanying this return code is JrInvalidRoutine. |
The name of a fullword in which the MVSThreadAffinity service stores the reason code. The MVSThreadAffinity service returns Reason_code only if Return_value is -1. Reason_code further qualifies the Return_code value. See z/OS UNIX System Services Messages and Codes for the reason codes.
There are no restrictions on the use of the MVSThreadAffinity service.
For an example using this callable service, see BPX1TAF (MVSThreadAffinity) example.