ARGOBOTS  1.1
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 #ifdef ABT_CONFIG_ENABLE_STACK_UNWIND
19 /* Peek context is needed only for stack unwinding. */
20 #define ABT_CONFIG_ENABLE_PEEK_CONTEXT
21 #endif
22 
24 
28 
29 static inline ABTD_ythread_context *
32 {
34 }
35 
36 static inline ABTD_ythread_context *
39 {
41 }
42 
45 {
46  ABTD_atomic_relaxed_store_ptr(&ptr->val, (void *)p_ctx);
47 }
48 
51 {
52  ABTD_atomic_release_store_ptr(&ptr->val, (void *)p_ctx);
53 }
54 
56 
58  size_t size, void (*thread_func)(void *));
60  ABTD_ythread_context *p_new, void *arg);
62  ABTD_ythread_context *p_new,
63  void *arg);
64 #if ABT_CONFIG_THREAD_TYPE == ABT_THREAD_TYPE_DYNAMIC_PROMOTION
66  void *sp,
67  void (*thread_func)(void *),
68  void *arg);
69 #endif
70 #ifdef ABT_CONFIG_ENABLE_PEEK_CONTEXT
71 static inline void ABTD_ythread_context_peek(ABTD_ythread_context *p_ctx,
72  void (*peek_func)(void *),
73  void *arg);
74 #endif
75 
76 void ABTD_ythread_print_context(ABTI_ythread *p_ythread, FILE *p_os,
77  int indent);
78 
79 #ifdef ABT_CONFIG_USE_FCONTEXT
80 #include "abtd_fcontext.h"
81 #else
82 #include "abtd_ucontext.h"
83 #endif
84 
85 #endif /* ABTD_CONTEXT_H_INCLUDED */
ABTD_atomic_release_store_ythread_context_ptr
static void ABTD_atomic_release_store_ythread_context_ptr(ABTD_ythread_context_atomic_ptr *ptr, ABTD_ythread_context *p_ctx)
Definition: abtd_context.h:49
ABTD_ythread_context_jump
static void ABTD_ythread_context_jump(ABTD_ythread_context *p_old, ABTD_ythread_context *p_new, void *arg)
ABTD_atomic_relaxed_store_ythread_context_ptr
static void ABTD_atomic_relaxed_store_ythread_context_ptr(ABTD_ythread_context_atomic_ptr *ptr, ABTD_ythread_context *p_ctx)
Definition: abtd_context.h:43
ABTD_atomic_relaxed_load_ythread_context_ptr
static ABTD_ythread_context * ABTD_atomic_relaxed_load_ythread_context_ptr(const ABTD_ythread_context_atomic_ptr *ptr)
Definition: abtd_context.h:30
ABTU_noreturn
#define ABTU_noreturn
Definition: abtu.h:118
abtd_fcontext.h
ABTD_ythread_context
Definition: abtd_fcontext.h:33
ABTD_ythread_context_init_and_call
static void ABTD_ythread_context_init_and_call(ABTD_ythread_context *p_ctx, void *sp, void(*thread_func)(void *), void *arg)
ABTD_atomic_ptr
Definition: abtd_atomic.h:39
abt_config.h
ABTD_atomic_release_store_ptr
static void ABTD_atomic_release_store_ptr(ABTD_atomic_ptr *ptr, void *val)
Definition: abtd_atomic.h:1136
ABTD_ythread_context::p_ctx
void * p_ctx
Definition: abtd_fcontext.h:34
ABTD_ythread_context_atomic_ptr
Definition: abtd_context.h:25
ABTD_ythread_context_atomic_ptr::val
ABTD_atomic_ptr val
Definition: abtd_context.h:26
ABTI_ythread
Definition: abti.h:406
ABTD_atomic_acquire_load_ptr
static void * ABTD_atomic_acquire_load_ptr(const ABTD_atomic_ptr *ptr)
Definition: abtd_atomic.h:979
ABTD_atomic_relaxed_store_ptr
static void ABTD_atomic_relaxed_store_ptr(ABTD_atomic_ptr *ptr, void *val)
Definition: abtd_atomic.h:1055
ABTD_ythread_context_make
static void ABTD_ythread_context_make(ABTD_ythread_context *p_ctx, void *sp, size_t size, void(*thread_func)(void *))
ABTD_ythread_context_take
static ABTU_noreturn void ABTD_ythread_context_take(ABTD_ythread_context *p_old, ABTD_ythread_context *p_new, void *arg)
abtd_ucontext.h
ABTD_ythread_context_atomic_ptr
struct ABTD_ythread_context_atomic_ptr ABTD_ythread_context_atomic_ptr
ABTD_atomic_relaxed_load_ptr
static void * ABTD_atomic_relaxed_load_ptr(const ABTD_atomic_ptr *ptr)
Definition: abtd_atomic.h:846
ABTD_atomic_acquire_load_ythread_context_ptr
static ABTD_ythread_context * ABTD_atomic_acquire_load_ythread_context_ptr(const ABTD_ythread_context_atomic_ptr *ptr)
Definition: abtd_context.h:37
ABTD_ythread_print_context
void ABTD_ythread_print_context(ABTI_ythread *p_ythread, FILE *p_os, int indent)
Definition: abtd_ythread.c:155