pthread_self (BPX1PTS, BPX4PTS) — Query the thread ID

Function

The pthread_self callable service gets the thread ID of the calling thread.

Requirements

Operation Environment
Authorization: Supervisor state or problem state, any PSW key
Dispatchable unit mode: Task
Cross memory mode: PASN = HASN
AMODE (BPX1PTS): 31-bit
AMODE (BPX4PTS): 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

CALL BPX1PTS,(Thread_ID)

AMODE 64 callers use BPX4PTS with the same parameter.

Parameters

Thread_ID
Returned parameter
Type:
Character string
Length:
8 bytes

The name of an 8-byte field in which the service places the thread ID of the calling thread.

Usage notes

  1. The caller should request this service only once when it needs the thread ID of the active thread. It should save a copy of the thread ID in its own storage for repeated usage.
  2. If this service fails, the calling thread ends abnormally.

Related services

Characteristics and restrictions

There are no restrictions on the use of the pthread_self service.

Examples

For an example using this callable service, see BPX1PTS (pthread_self) example.