ARGOBOTS  dce6e727ffc4ca5b3ffc04cb9517c6689be51ec5
abtd_context.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 ABTD_CONTEXT_H_INCLUDED
7 #define ABTD_CONTEXT_H_INCLUDED
8 
9 #include "abt_config.h"
10 
11 #ifndef ABT_CONFIG_USE_FCONTEXT
12 #ifndef _XOPEN_SOURCE
13 #define _XOPEN_SOURCE
14 #endif
15 #include <ucontext.h>
16 #endif
17 
18 typedef struct ABTD_ythread_context ABTD_ythread_context;
19 
20 typedef struct ABTD_ythread_context_atomic_ptr {
21  ABTD_atomic_ptr val;
22 } ABTD_ythread_context_atomic_ptr;
23 
24 static inline ABTD_ythread_context *
25 ABTD_atomic_relaxed_load_ythread_context_ptr(
26  const ABTD_ythread_context_atomic_ptr *ptr)
27 {
28  return (ABTD_ythread_context *)ABTD_atomic_relaxed_load_ptr(&ptr->val);
29 }
30 
31 static inline ABTD_ythread_context *
32 ABTD_atomic_acquire_load_ythread_context_ptr(
33  const ABTD_ythread_context_atomic_ptr *ptr)
34 {
35  return (ABTD_ythread_context *)ABTD_atomic_acquire_load_ptr(&ptr->val);
36 }
37 
38 static inline void ABTD_atomic_relaxed_store_ythread_context_ptr(
39  ABTD_ythread_context_atomic_ptr *ptr, ABTD_ythread_context *p_ctx)
40 {
41  ABTD_atomic_relaxed_store_ptr(&ptr->val, (void *)p_ctx);
42 }
43 
44 static inline void ABTD_atomic_release_store_ythread_context_ptr(
45  ABTD_ythread_context_atomic_ptr *ptr, ABTD_ythread_context *p_ctx)
46 {
47  ABTD_atomic_release_store_ptr(&ptr->val, (void *)p_ctx);
48 }
49 
50 void ABTD_ythread_func_wrapper(ABTD_ythread_context *p_arg);
51 void ABTD_ythread_print_context(ABTI_ythread *p_ythread, FILE *p_os,
52  int indent);
53 
54 #ifdef ABT_CONFIG_USE_FCONTEXT
55 #include "abtd_fcontext.h"
56 #else
57 #include "abtd_ucontext.h"
58 #endif
59 
60 #endif /* ABTD_CONTEXT_H_INCLUDED */
abtd_fcontext.h
abt_config.h
abtd_ucontext.h