SST/macro
thread_info.h
Go to the documentation of this file.
1 #ifndef THREAD_INFO_H
2 #define THREAD_INFO_H
3 
4 #include <pthread.h>
6 
7 namespace sstmac {
8 
9 class thread_info {
10  public:
11  static void
13 
14  static void
15  register_user_space_virtual_thread(int phys_thread_id, void* stack, size_t stacksize);
16 
17  static inline int
19 #if SSTMAC_HAVE_UCONTEXT
20  return user_space_thread_id();
21 #else
22  return kernel_space_thread_id();
23 #endif
24  }
25 
26  protected:
27  static int kernel_space_thread_id();
28 
29  static inline int
31  char x;
32  size_t stackptr = (size_t) &x;
33  size_t stack_mult = stackptr / stacksize_;
34  size_t aligned_stack_ptr = stack_mult * stacksize_;
35  int* tls = (int*) aligned_stack_ptr;
36  return tls[0];
37  }
38 
39  static size_t stacksize_;
40 
41 
42 
43 };
44 
45 }
46 
47 #endif // THREAD_INFO_H
#define pthread_t
int thread_id
Definition: thread_id.h:21
static void register_user_space_virtual_thread(int phys_thread_id, void *stack, size_t stacksize)
static void register_kernel_space_virtual_thread(int thread_id, pthread_t *thr, pthread_attr_t *attrs)
SUMI = Simulator unified messagine interface It is also the name for a solid ink in Japanese - i...
static int user_space_thread_id()
Definition: thread_info.h:30
static int kernel_space_thread_id()
#define pthread_attr_t
static int current_physical_thread_id()
Definition: thread_info.h:18
static size_t stacksize_
Definition: thread_info.h:39