X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/2b0e833b299b04a1502b647df1a8ff240f9ea753..467944fe0ac76fb00b1e9b3a919b1ce4a165ef0f:/src/simix/smx_context_sysv.c diff --git a/src/simix/smx_context_sysv.c b/src/simix/smx_context_sysv.c index 47a7e55049..775db1c1be 100644 --- a/src/simix/smx_context_sysv.c +++ b/src/simix/smx_context_sysv.c @@ -1,34 +1,25 @@ -/* $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 /* 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 #endif /* HAVE_VALGRIND_VALGRIND_H */ -XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix_context); +#ifdef WIN32 + #include "ucontext.h" + #include "ucontext.c" +#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, @@ -67,10 +58,10 @@ smx_ctx_sysv_create_context_sized(size_t size, xbt_main_func_t code, int argc, c 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 =