Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
The file containing the new implementation of the switch context mechanism.
[simgrid.git] / src / xbt / xbt_ucontext.h
diff --git a/src/xbt/xbt_ucontext.h b/src/xbt/xbt_ucontext.h
new file mode 100644 (file)
index 0000000..b2ce72f
--- /dev/null
@@ -0,0 +1,27 @@
+#ifndef _XBT_UCONTEXT_H\r
+#define _XBT_UCONTEXT_H\r
+\r
+#include "ucontext_stack.h"            /* loads context system definitions                                                                                                                     */\r
+#include <ucontext.h>                  /* context relative declarations                                                                                                                        */                              \r
+#define STACK_SIZE 128*1024            /* lower this if you want to reduce the memory consumption                                                                      */\r
+\r
+#ifndef _XBT_CONTEXT_FACTORY_T_DEFINED\r
+typedef struct s_xbt_context_factory* xbt_context_factory_t;\r
+#define _XBT_CONTEXT_FACTORY_T_DEFINED\r
+#endif /* !_XBT_CONTEXT_FACTORY_T_DEFINED */\r
+\r
+typedef struct s_xbt_ucontext\r
+{\r
+       XBT_CTX_BASE_T;\r
+       ucontext_t uc;                                  /* the thread that execute the code                                                                                                                     */\r
+       char stack[STACK_SIZE];                 /* the thread stack size                                                                                                                                        */\r
+       struct s_xbt_ucontext* prev;            /* the previous thread                                                                                                                                  */\r
+}s_xbt_ucontext_t,* xbt_ucontext_t;\r
+\r
+\r
+int\r
+xbt_ucontext_factory_init(xbt_context_factory_t* factory);\r
+\r
+SG_END_DECL()\r
+\r
+#endif /* !_XBT_UCONTEXT_H */\r