Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
5e061e4b5aa831e8e1986760c907ff43178da3a6
[simgrid.git] / src / xbt / xbt_context_private.h
1 #ifndef _XBT_CONTEXT_PRIVATE_H\r
2 #define _XBT_CONTEXT_PRIVATE_H\r
3 \r
4 #include "xbt/sysdep.h"\r
5 #include "xbt/xbt_context.h"\r
6 \r
7 SG_BEGIN_DECL()\r
8 \r
9 /* the following function pointers describe the interface that all context concepts must implement */\r
10 \r
11 typedef void (*xbt_pfn_context_free_t)(xbt_context_t);          /* pointer type to the function used to destroy the specified context   */\r
12 typedef void (*xbt_pfn_context_kill_t)(xbt_context_t);          /* pointer type to the function used to kill the specified context              */\r
13 typedef void (*xbt_pfn_context_schedule_t)(xbt_context_t);      /* pointer type to the function used to resume the specified context    */\r
14 typedef void (*xbt_pfn_context_yield_t)(void);                          /* pointer type to the function used to yield the specified context             */\r
15 typedef void (*xbt_pfn_context_start_t)(xbt_context_t);         /* pointer type to the function used to start the specified context             */\r
16 typedef void (*xbt_pfn_context_stop_t)(int);                            /* pointer type to the function used to stop the current context                */\r
17 \r
18 /* each context concept must use this macro in its declaration */\r
19 #define XBT_CTX_BASE_T \\r
20         s_xbt_swag_hookup_t hookup; \\r
21         char *name; \\r
22         void_f_pvoid_t cleanup_func; \\r
23         void *cleanup_arg; \\r
24         ex_ctx_t *exception; \\r
25         int iwannadie; \\r
26         xbt_main_func_t code; \\r
27         int argc; \\r
28         char **argv; \\r
29         void_f_pvoid_t startup_func; \\r
30         void *startup_arg; \\r
31         xbt_pfn_context_free_t free; \\r
32         xbt_pfn_context_kill_t kill; \\r
33         xbt_pfn_context_schedule_t schedule; \\r
34         xbt_pfn_context_yield_t yield; \\r
35         xbt_pfn_context_start_t start; \\r
36         xbt_pfn_context_stop_t stop                             \r
37 \r
38 /* all other contexts derive from this structure */\r
39 typedef struct s_xbt_context\r
40 {\r
41         XBT_CTX_BASE_T;\r
42 }s_xbt_context_t;\r
43 \r
44 SG_END_DECL()\r
45         \r
46 \r
47 #ifdef CONTEXT_THREADS\r
48 #include "xbt_thread_context.h" /* thread based context declarations            */\r
49 #elif !defined(WIN32)\r
50 #include "xbt_ucontext.h"               /* ucontext based context declarations          */\r
51 #else\r
52 #error ERROR [__FILE__, line __LINE__]: no context based implementation specified.\r
53 #endif\r
54 \r
55 #include "xbt_jcontext.h"               /* java thread based context declarations       */      \r
56 \r
57 #endif /* !_XBT_CONTEXT_PRIVATE_H */\r