[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gcc
Subject:    ompd_get_thread_id() in OMPD implementation
From:       Ahmed Sayed Mousse via Gcc <gcc () gcc ! gnu ! org>
Date:       2022-03-25 18:45:51
Message-ID: CAG6G2ys1bgZW_n3wgRv-cRVMjBKG4TEpw8n80FXtPbs=+mTg9Q () mail ! gmail ! com
[Download RAW message or body]

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.
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic