f_pthread_key_create(key, dtr)

Purpose

This function can be used to acquire a thread-specific data key. The key will be returned in the argument key. The argument dtr is a subroutine that will be used to destruct the thread-specific data associated with this key when any thread terminates after this calling point. The destructor will receive the thread-specific data as its argument. The destructor itself is optional. If it is not provided, the system will not invoke any destructor on the thread-specific data associated with this key. Note that the number of thread-specific data keys is limited in each process. It is the user's responsibility to manage the usage of the keys. The per-process limit can be checked by the Fortran constant PTHREAD_DATAKEYS_MAX.

Class

Function

Argument Type and Attributes

key
TYPE(f_pthread_key_t), INTENT(OUT)

dtr
External, optional subroutine

Result Type and Attributes

INTEGER(4)

Result Value

On successful completion, this function returns 0. Otherwise, this function returns one of the following errors.

EAGAIN
The maximum number of keys has been exceeded.

EINVAL
The argument key is invalid.

ENOMEM
There is insufficient memory to create this key.
IBM Copyright 2003