Blame man/man3/PAPI_set_thr_specific.3

Packit 577717
.TH "PAPI_set_thr_specific" 3 "Mon Dec 18 2017" "Version 5.6.0.0" "PAPI" \" -*- nroff -*-
Packit 577717
.ad l
Packit 577717
.nh
Packit 577717
.SH NAME
Packit 577717
PAPI_set_thr_specific \- 
Packit 577717
.PP
Packit 577717
Store a pointer to a thread specific data structure\&.  
Packit 577717
Packit 577717
.SH SYNOPSIS
Packit 577717
.br
Packit 577717
.PP
Packit 577717
.SH "Detailed Description"
Packit 577717
.PP 
Packit 577717
Packit 577717
.PP
Packit 577717
.nf
Packit 577717
@par Prototype:
Packit 577717
    \#include <papi.h> @n
Packit 577717
    int PAPI_set_thr_specific( int tag, void *ptr );
Packit 577717
Packit 577717
@param tag
Packit 577717
    An identifier, the value of which is either PAPI_USR1_TLS or 
Packit 577717
    PAPI_USR2_TLS. This identifier indicates which of several data 
Packit 577717
    structures associated with this thread is to be accessed.
Packit 577717
@param ptr
Packit 577717
    A pointer to the memory containing the data structure. 
Packit 577717
Packit 577717
@retval PAPI_OK
Packit 577717
@retval PAPI_EINVAL 
Packit 577717
    The @em tag argument is out of range. 
Packit 577717
Packit 577717
In C, PAPI_set_thr_specific will save @em ptr into an array indexed by @em tag. 
Packit 577717
There are 2 user available locations and @em tag can be either 
Packit 577717
PAPI_USR1_TLS or PAPI_USR2_TLS. 
Packit 577717
The array mentioned above is managed by PAPI and allocated to each 
Packit 577717
thread which has called PAPI_thread_init. 
Packit 577717
There is no Fortran equivalent function. 
Packit 577717
Packit 577717
@par Example:
Packit 577717
Packit 577717
.fi
Packit 577717
.PP
Packit 577717
 
Packit 577717
.PP
Packit 577717
.nf
Packit 577717
int ret;
Packit 577717
HighLevelInfo *state = NULL;
Packit 577717
ret = PAPI_thread_init(pthread_self);
Packit 577717
if (ret != PAPI_OK) handle_error(ret);
Packit 577717
 
Packit 577717
// Do we have the thread specific data setup yet?
Packit 577717
Packit 577717
ret = PAPI_get_thr_specific(PAPI_USR1_TLS, (void *) &state);
Packit 577717
if (ret != PAPI_OK || state == NULL) {
Packit 577717
    state = (HighLevelInfo *) malloc(sizeof(HighLevelInfo));
Packit 577717
    if (state == NULL) return (PAPI_ESYS);
Packit 577717
    memset(state, 0, sizeof(HighLevelInfo));
Packit 577717
    state->EventSet = PAPI_NULL;
Packit 577717
    ret = PAPI_create_eventset(&state->EventSet);
Packit 577717
    if (ret != PAPI_OK) return (PAPI_ESYS);
Packit 577717
    ret = PAPI_set_thr_specific(PAPI_USR1_TLS, state);
Packit 577717
    if (ret != PAPI_OK) return (ret);
Packit 577717
}
Packit 577717
 *  
Packit 577717
Packit 577717
.fi
Packit 577717
.PP
Packit 577717
 
Packit 577717
.PP
Packit 577717
\fBSee Also:\fP
Packit 577717
.RS 4
Packit 577717
\fBPAPI_register_thread\fP \fBPAPI_thread_init\fP \fBPAPI_thread_id\fP \fBPAPI_get_thr_specific\fP 
Packit 577717
.RE
Packit 577717
.PP
Packit 577717
Packit 577717
Packit 577717
.SH "Author"
Packit 577717
.PP 
Packit 577717
Generated automatically by Doxygen for PAPI from the source code\&.