-/* $Id$ */
+/* context_sysv - context switching with ucontextes from System V */
-/* context_sysv - implementation of context switching with ucontextes from Sys V */
+/* Copyright (c) 2009, 2010. The SimGrid Team.
+ * All rights reserved. */
-/* Copyright (c) 2004-2008 the SimGrid team. All right reserved */
+ /* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
-/* This program is free software; you can redistribute it and/or modify it
- * under the terms of the license (GNU LGPL) which comes with this package. */
-#include "smx_context_private.h"
-#include "context_sysv_config.h" /* loads context system definitions */
-#include "portable.h"
-#include <ucontext.h> /* context relative declarations */
-/* lower this if you want to reduce the memory consumption */
-#define STACK_SIZE 128*1024
+#include "smx_context_sysv_private.h"
#ifdef HAVE_VALGRIND_VALGRIND_H
# include <valgrind/valgrind.h>
#endif /* HAVE_VALGRIND_VALGRIND_H */
-XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix_context);
+#ifdef _XBT_WIN32
+ #include "win32_ucontext.h"
+ #include "win32_ucontext.c"
+#else
+ #include "ucontext.h"
+#endif
-typedef struct s_smx_ctx_sysv {
- s_smx_ctx_base_t super; /* Fields of super implementation */
- ucontext_t uc; /* the thread that execute the code */
- char stack[STACK_SIZE]; /* the thread stack size */
-#ifdef HAVE_VALGRIND_VALGRIND_H
- unsigned int valgrind_stack_id; /* the valgrind stack id */
-#endif
-} s_smx_ctx_sysv_t, *smx_ctx_sysv_t;
+XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix_context);
static smx_context_t
smx_ctx_sysv_create_context(xbt_main_func_t code, int argc, char** argv,
context->uc.uc_link = NULL;
context->uc.uc_stack.ss_sp =
- pth_skaddr_makecontext(context->stack, STACK_SIZE);
+ pth_skaddr_makecontext(context->stack, CONTEXT_STACK_SIZE);
context->uc.uc_stack.ss_size =
- pth_sksize_makecontext(context->stack, STACK_SIZE);
+ pth_sksize_makecontext(context->stack, CONTEXT_STACK_SIZE);
#ifdef HAVE_VALGRIND_VALGRIND_H
context->valgrind_stack_id =