Hi everyone,
I was doing a research to help me implement the function
“ompd_get_thread_id” from the OpenMP API specification under section
20.5.5.5.
In this function I need to return a native thread identifier and from
research I found that it’s a “pthread_t” handle which exists inside a
struct named “gomp_thread” of the “libgomp.h” file. The problem is that
this handle isn’t always defined and to show what I mean look at the code
below.
struct gomp_thread
{
…..
#if defined(LIBGOMP_USE_PTHREADS) \
&& (!defined(HAVE_TLS) \
|| !defined(__GLIBC__) \
|| !defined(USING_INITIAL_EXEC_TLS))
#define GOMP_NEEDS_THREAD_HANDLE 1
pthread_t handle;
#endif
};
I use a macro to calculate the offset of this handle and use the this
offset to get it from memory and I thought I would just check for
GOMP_NEEDS_THREAD_HANDLE before trying to calculate this offset but It
still causes errors and also if that handle isn’t defined then what should
I return as a native identifier?
Thanks for help.