ARGOBOTS  66b1c39742507d8df30e8d28c54839b961a14814
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
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 #define _XOPEN_SOURCE
13 #include <ucontext.h>
14 #endif
15 
17 
21 
22 static inline ABTD_ythread_context *
25 {
27 }
28 
29 static inline ABTD_ythread_context *
32 {
34 }
35 
38 {
39  ABTD_atomic_relaxed_store_ptr(&ptr->val, (void *)p_ctx);
40 }
41 
44 {
45  ABTD_atomic_release_store_ptr(&ptr->val, (void *)p_ctx);
46 }
47 
49  void *p_ctx; /* actual context of fcontext, or a
50  * pointer to uctx */
51  ABTD_ythread_context_atomic_ptr p_link; /* pointer to scheduler context */
52 #ifndef ABT_CONFIG_USE_FCONTEXT
53  ucontext_t uctx; /* ucontext entity pointed by p_ctx */
54  void (*f_uctx_thread)(void *); /* root function called by ucontext */
55  void *p_uctx_arg; /* argument for root function */
56 #endif
57 };
58 
59 static void ABTD_ythread_context_make(ABTD_ythread_context *p_ctx, void *sp,
60  size_t size, void (*thread_func)(void *));
62  ABTD_ythread_context *p_new, void *arg);
64  ABTD_ythread_context *p_new,
65  void *arg);
66 #if ABT_CONFIG_THREAD_TYPE == ABT_THREAD_TYPE_DYNAMIC_PROMOTION
68  void *sp,
69  void (*thread_func)(void *),
70  void *arg);
71 #endif
72 
73 void ABTD_ythread_print_context(ABTI_ythread *p_ythread, FILE *p_os,
74  int indent);
75 
76 #ifdef ABT_CONFIG_USE_FCONTEXT
77 #include "abtd_fcontext.h"
78 #else
79 #include "abtd_ucontext.h"
80 #endif
81 
82 #endif /* ABTD_CONTEXT_H_INCLUDED */
static void ABTD_ythread_context_jump(ABTD_ythread_context *p_old, ABTD_ythread_context *p_new, void *arg)
ABTD_ythread_context_atomic_ptr p_link
Definition: abtd_context.h:51
struct ABTD_ythread_context_atomic_ptr ABTD_ythread_context_atomic_ptr
static ABTU_noreturn void ABTD_ythread_context_take(ABTD_ythread_context *p_old, ABTD_ythread_context *p_new, void *arg)
static void * ABTD_atomic_acquire_load_ptr(const ABTD_atomic_ptr *ptr)
Definition: abtd_atomic.h:848
static void ABTD_atomic_relaxed_store_ythread_context_ptr(ABTD_ythread_context_atomic_ptr *ptr, ABTD_ythread_context *p_ctx)
Definition: abtd_context.h:36
static ABTD_ythread_context * ABTD_atomic_relaxed_load_ythread_context_ptr(const ABTD_ythread_context_atomic_ptr *ptr)
Definition: abtd_context.h:23
static void ABTD_atomic_relaxed_store_ptr(ABTD_atomic_ptr *ptr, void *val)
Definition: abtd_atomic.h:914
void ABTD_ythread_print_context(ABTI_ythread *p_ythread, FILE *p_os, int indent)
Definition: abtd_ythread.c:148
static void ABTD_ythread_context_init_and_call(ABTD_ythread_context *p_ctx, void *sp, void(*thread_func)(void *), void *arg)
static void * ABTD_atomic_relaxed_load_ptr(const ABTD_atomic_ptr *ptr)
Definition: abtd_atomic.h:731
static void ABTD_atomic_release_store_ptr(ABTD_atomic_ptr *ptr, void *val)
Definition: abtd_atomic.h:983
#define ABTU_noreturn
Definition: abtu.h:31
static void ABTD_ythread_context_make(ABTD_ythread_context *p_ctx, void *sp, size_t size, void(*thread_func)(void *))
static void ABTD_atomic_release_store_ythread_context_ptr(ABTD_ythread_context_atomic_ptr *ptr, ABTD_ythread_context *p_ctx)
Definition: abtd_context.h:42
static ABTD_ythread_context * ABTD_atomic_acquire_load_ythread_context_ptr(const ABTD_ythread_context_atomic_ptr *ptr)
Definition: abtd_context.h:30