1 #ifndef _XBT_CONTEXT_PRIVATE_H
\r
2 #define _XBT_CONTEXT_PRIVATE_H
\r
4 #include "xbt/sysdep.h"
\r
5 #include "xbt/context.h"
\r
6 #include "xbt/swag.h"
\r
10 /* the following function pointers describe the interface that all context concepts must implement */
\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
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
23 void_f_pvoid_t cleanup_func; \
\r
24 void *cleanup_arg; \
\r
25 ex_ctx_t *exception; \
\r
27 xbt_main_func_t code; \
\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
39 /* all other contexts derive from this structure */
\r
40 typedef struct s_xbt_context
\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
53 /* All factories init */
\r
54 typedef struct s_xbt_context_factory* xbt_context_factory_t;
\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
63 #endif /* !_XBT_CONTEXT_PRIVATE_H */
\r