Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Ansi C declaration of the variables (at the beginning of the blocks)
[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/context.h"\r
6 #include "xbt/swag.h"\r
7 \r
8 SG_BEGIN_DECL()\r
9 \r
10 /* the following function pointers describe the interface that all context concepts must implement */\r
11 \r
12 typedef void (*xbt_pfn_context_free_t)(xbt_context_t);          /* pointer type to the function used to destroy the specified context   */\r
13 typedef void (*xbt_pfn_context_kill_t)(xbt_context_t);          /* pointer type to the function used to kill the specified context              */\r
14 typedef void (*xbt_pfn_context_schedule_t)(xbt_context_t);      /* pointer type to the function used to resume the specified context    */\r
15 typedef void (*xbt_pfn_context_yield_t)(void);                          /* pointer type to the function used to yield the specified context             */\r
16 typedef void (*xbt_pfn_context_start_t)(xbt_context_t);         /* pointer type to the function used to start the specified context             */\r
17 typedef void (*xbt_pfn_context_stop_t)(int);                            /* pointer type to the function used to stop the current context                */\r
18 \r
19 /* each context concept must use this macro in its declaration */\r
20 #define XBT_CTX_BASE_T \\r
21         s_xbt_swag_hookup_t hookup; \\r
22         char *name; \\r
23         void_f_pvoid_t cleanup_func; \\r
24         void *cleanup_arg; \\r
25         ex_ctx_t *exception; \\r
26         int iwannadie; \\r
27         xbt_main_func_t code; \\r
28         int argc; \\r
29         char **argv; \\r
30         void_f_pvoid_t startup_func; \\r
31         void *startup_arg; \\r
32         xbt_pfn_context_free_t free; \\r
33         xbt_pfn_context_kill_t kill; \\r
34         xbt_pfn_context_schedule_t schedule; \\r
35         xbt_pfn_context_yield_t yield; \\r
36         xbt_pfn_context_start_t start; \\r
37         xbt_pfn_context_stop_t stop                             \r
38 \r
39 /* all other contexts derive from this structure */\r
40 typedef struct s_xbt_context\r
41 {\r
42         XBT_CTX_BASE_T;\r
43 }s_xbt_context_t;\r
44 \r
45 /* Important guys */\r
46 extern xbt_context_t current_context;\r
47 extern xbt_context_t maestro_context;\r
48 /* All dudes lists */\r
49 extern xbt_swag_t context_living;\r
50 extern xbt_swag_t context_to_destroy;\r
51 \r
52 \r
53 /* All factories init */\r
54 typedef struct s_xbt_context_factory* xbt_context_factory_t;\r
55 \r
56 int xbt_thread_context_factory_init(xbt_context_factory_t* factory);\r
57 int xbt_ucontext_factory_init(xbt_context_factory_t* factory);\r
58 int xbt_jcontext_factory_init(xbt_context_factory_t* factory);\r
59 \r
60 \r
61 SG_END_DECL()\r
62 \r
63 #endif /* !_XBT_CONTEXT_PRIVATE_H */\r