PAPI_get_thr_specific(3)
π PAPI_get_thr_specific(3) π
okay bestie, this one's from the PAPI manual β and it's literally about grabbing a pointer to a thread specific data structure. no cap. π«Ά
β¨ NAME β¨
PAPI_get_thr_specific β retrieve a pointer to a thread specific data structure. π
πΈ SYNOPSIS πΈ
the detailed description is right below, bestie β keep scrolling π
π DETAILED DESCRIPTION π
π Prototype π
Prototype:
#include <papi.h>
int PAPI_get_thr_specific( int tag, void **ptr );
π Parameters π
tagβ an identifier, the value of which is eitherPAPI_USR1_TLSorPAPI_USR2_TLS. This identifier indicates which of several data structures associated with this thread is to be accessed.ptrβ a pointer to the memory containing the data structure.
π«Ά Return values π«Ά
PAPI_OKPAPI_EINVALβ thetagargument is out of range.
In C, PAPI_get_thr_specific PAPI_get_thr_specific β yes, the page really says it twice, and we're keeping it β will retrieve the pointer from the array with index tag. There are 2 user available locations and tag can be either PAPI_USR1_TLS or PAPI_USR2_TLS. The array mentioned above is managed by PAPI and allocated to each thread which has called PAPI_thread_init. There is no Fortran equivalent function. π
π Example π
int ret;
RateInfo *state = NULL;
ret = PAPI_thread_init(pthread_self);
if (ret != PAPI_OK) handle_error(ret);
// Do we have the thread specific data setup yet?
ret = PAPI_get_thr_specific(PAPI_USR1_TLS, (void *) &state);
if (ret != PAPI_OK || state == NULL) {
state = (RateInfo *) malloc(sizeof(RateInfo));
if (state == NULL) return (PAPI_ESYS);
memset(state, 0, sizeof(RateInfo));
state->EventSet = PAPI_NULL;
ret = PAPI_create_eventset(&state->EventSet);
if (ret != PAPI_OK) return (PAPI_ESYS);
ret = PAPI_set_thr_specific(PAPI_USR1_TLS, state);
if (ret != PAPI_OK) return (ret);
}
π₯ See also π₯
PAPI_register_threadPAPI_thread_initPAPI_thread_idPAPI_set_thr_specific
π AUTHOR π
Generated automatically by Doxygen for PAPI from the source code.
mwah π this iconic page is from PAPI version 7.2.0.0, dated Wed Jun 25 2025 19:30:48 β and that's the whole sign-off, bestie. π
π¦ where this page comes from
- nixos 26.05: papi 7.2.0
- nixpkgs unstable: papi 7.2.0
- opensuse-leap 16.0: papi-devel 7.2.0-160000.2.2 Β· BSD-3-Clause
- opensuse-leap 16.0: papi-devel 7.2.0-160000.2.2 Β· BSD-3-Clause
- opensuse-leap 16.0: papi-devel 7.2.0-160000.2.2 Β· BSD-3-Clause
- ubuntu resolute: libpapi-dev 7.2.0-2 Β· BSD-3-Clause
- ubuntu stonking: libpapi-dev 7.2.0-2 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms