Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Consider the case of windows context, update xbt_context_new() and xbt_context_destro...
authorcherierm <cherierm@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Thu, 5 Oct 2006 17:05:36 +0000 (17:05 +0000)
committercherierm <cherierm@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Thu, 5 Oct 2006 17:05:36 +0000 (17:05 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@2853 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/xbt/context.c

index c62a7a6..0e53a7e 100644 (file)
@@ -100,6 +100,12 @@ static void xbt_context_destroy(xbt_context_t context)
   pthread_cond_destroy(&(context->cond));
 #endif
   if(context->exception) free(context->exception);
   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;
 }
   free(context);
   return;
 }
@@ -281,6 +287,9 @@ xbt_context_t xbt_context_new(xbt_context_function_t code,
 # ifndef USE_WIN_CONTEXT    
   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);
 # ifndef USE_WIN_CONTEXT    
   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);
+#else
+  res->uc.uc_stack.ss_sp = xbt_malloc(STACK_SIZE);
+  res->uc.uc_stack.ss_size = STACK_SIZE ;
 # endif /* USE_WIN_CONTEXT */
 #endif /* USE_PTHREADS or not */
   res->argc = argc;
 # endif /* USE_WIN_CONTEXT */
 #endif /* USE_PTHREADS or not */
   res->argc = argc;