ARGOBOTS  dce6e727ffc4ca5b3ffc04cb9517c6689be51ec5
abti_self.h
Go to the documentation of this file.
1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
2 /*
3  * See COPYRIGHT in top-level directory.
4  */
5 
6 #ifndef ABTI_SELF_H_INCLUDED
7 #define ABTI_SELF_H_INCLUDED
8 
9 static inline ABTI_native_thread_id
10 ABTI_self_get_native_thread_id(ABTI_local *p_local)
11 {
12  ABTI_xstream *p_local_xstream = ABTI_local_get_xstream_or_null(p_local);
13  /* This is when an external thread called this routine. */
14  if (ABTI_IS_EXT_THREAD_ENABLED && p_local_xstream == NULL) {
15  /* A pointer to a thread local variable can distinguish all external
16  * threads and execution streams. */
17  return (ABTI_native_thread_id)ABTI_local_get_local_ptr();
18  }
19  return (ABTI_native_thread_id)p_local_xstream;
20 }
21 
22 static inline ABTI_thread_id ABTI_self_get_thread_id(ABTI_local *p_local)
23 {
24  ABTI_xstream *p_local_xstream = ABTI_local_get_xstream_or_null(p_local);
25  /* This is when an external thread called this routine. */
26  if (ABTI_IS_EXT_THREAD_ENABLED && p_local_xstream == NULL) {
27  /* A pointer to a thread local variable is unique to an external thread
28  * and its value is different from pointers to ULTs and tasks. */
29  return (ABTI_thread_id)ABTI_local_get_local_ptr();
30  }
31  return (ABTI_thread_id)p_local_xstream->p_thread;
32 }
33 
34 #endif /* ABTI_SELF_H_INCLUDED */