X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/5b32d08cb7d3c3563120366a1b508a325e8d5da3..76a2cb65061dc45998500b63050c18bbbea8a09e:/src/xbt/context.c diff --git a/src/xbt/context.c b/src/xbt/context.c index fd3c271766..9b0fc97848 100644 --- a/src/xbt/context.c +++ b/src/xbt/context.c @@ -13,9 +13,8 @@ #include "context_private.h" #include "xbt/log.h" #include "xbt/dynar.h" -#include "gras_config.h" -XBT_LOG_NEW_DEFAULT_SUBCATEGORY(context, xbt, "Context"); +XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_ctx, xbt, "Context"); #define VOIRP(expr) DEBUG1(" {" #expr " = %p }", expr) @@ -101,6 +100,12 @@ static void xbt_context_destroy(xbt_context_t context) pthread_cond_destroy(&(context->cond)); #endif if(context->exception) free(context->exception); + +#ifdef USE_WIN_CONTEXT + if(context->uc.uc_stack.ss_sp) + free (context->uc.uc_stack.ss_sp); +#endif + free(context); return; } @@ -175,7 +180,13 @@ static ex_ctx_t *__context_ex_ctx(void) static void __context_ex_terminate(xbt_ex_t *e) { xbt_ex_display(e); - __context_exit(current_context, e->value); + abort(); + /* FIXME: there should be a configuration variable to choose this + if(current_context!=init_context) + __context_exit(current_context, e->value); + else + abort(); + */ } /** \name Functions @@ -273,7 +284,10 @@ xbt_context_t xbt_context_new(xbt_context_function_t code, /* WARNING : when this context is over, the current_context (i.e. the father), is awaken... Theorically, the wrapper should prevent using this feature. */ -# ifndef USE_WIN_CONTEXT +# ifdef USE_WIN_CONTEXT + res->uc.uc_stack.ss_sp = xbt_malloc(STACK_SIZE); + res->uc.uc_stack.ss_size = STACK_SIZE ; +#else res->uc.uc_stack.ss_sp = pth_skaddr_makecontext(res->stack,STACK_SIZE); res->uc.uc_stack.ss_size = pth_sksize_makecontext(res->stack,STACK_SIZE); # endif /* USE_WIN_CONTEXT */