public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* ompd_get_thread_id() in OMPD implementation
@ 2022-03-25 18:45 Ahmed Sayed Mousse
  0 siblings, 0 replies; only message in thread
From: Ahmed Sayed Mousse @ 2022-03-25 18:45 UTC (permalink / raw)
  To: gcc; +Cc: jakub

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.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-03-25 18:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-25 18:45 ompd_get_thread_id() in OMPD implementation Ahmed Sayed Mousse

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).