Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fixup the context build
[simgrid.git] / src / xbt / context.c
index a4f1096..a88d8ef 100644 (file)
@@ -11,7 +11,7 @@
 
 #include "portable.h"
 #include "context_private.h"
-#include "xbt/error.h"
+#include "xbt/log.h"
 #include "xbt/dynar.h"
 #include "gras_config.h"
 
@@ -35,8 +35,6 @@ static xbt_swag_t context_living = NULL;
 
 static void __xbt_context_yield(xbt_context_t context)
 {
-  int return_value = 0;
-
   xbt_assert0(current_context,"You have to call context_init() first.");
   
   DEBUG2("--------- current_context (%p) is yielding to context(%p) ---------",
@@ -65,6 +63,9 @@ static void __xbt_context_yield(xbt_context_t context)
   VOIRP(context);
   if(context) VOIRP(context->save);
   if (context) {
+
+    int return_value = 0;
+
     if(context->save==NULL) {
       DEBUG0("**** Yielding to somebody else ****");
       DEBUG2("Saving current_context value (%p) to context(%p)->save",current_context,context);
@@ -99,6 +100,7 @@ static void xbt_context_destroy(xbt_context_t context)
   pthread_mutex_destroy(&(context->mutex));
   pthread_cond_destroy(&(context->cond));
 #endif
+  if(context->exception) free(context->exception);
   free(context);
   return;
 }
@@ -147,7 +149,7 @@ static ex_ctx_t *__context_ex_ctx(void)
 }
 
 /* callback: termination */
-static void __context_ex_terminate(ex_t *e)
+static void __context_ex_terminate(xbt_ex_t *e)
 {
   exit(e->value);
 }
@@ -320,7 +322,6 @@ void xbt_context_free(xbt_context_t context)
   for(i=0;i<context->argc; i++) 
     if(context->argv[i]) free(context->argv[i]);
   if(context->argv) free(context->argv);
-  if(context->exception) free(context->exception);
   
   if(context->cleanup_func)
     context->cleanup_func(context->cleanup_arg);