Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use new macros THROWF and RETHROWF.
[simgrid.git] / src / simix / smx_context_sysv.c
index f7f59fd..5759fa6 100644 (file)
@@ -19,7 +19,6 @@
 
 #ifdef _XBT_WIN32
 #include "win32_ucontext.h"
-#include "win32_ucontext.c"
 #else
 #include "ucontext.h"
 #endif
@@ -54,7 +53,7 @@ union u_ctx_addr {
 void SIMIX_ctx_sysv_factory_init(smx_context_factory_t *factory)
 {
   smx_ctx_base_factory_init(factory);
-  VERB0("Activating SYSV context factory");
+  XBT_VERB("Activating SYSV context factory");
 
   (*factory)->finalize = smx_ctx_sysv_factory_finalize;
   (*factory)->create_context = smx_ctx_sysv_create_context;
@@ -71,7 +70,7 @@ void SIMIX_ctx_sysv_factory_init(smx_context_factory_t *factory)
     (*factory)->self = smx_ctx_sysv_self_parallel;
     (*factory)->get_thread_id = smx_ctx_sysv_get_thread_id;
 #else
-    THROW0(arg_error, 0, "No thread support for parallel context execution");
+    THROWF(arg_error, 0, "No thread support for parallel context execution");
 #endif
   }else{
     (*factory)->runall = smx_ctx_sysv_runall;
@@ -80,8 +79,10 @@ void SIMIX_ctx_sysv_factory_init(smx_context_factory_t *factory)
 
 int smx_ctx_sysv_factory_finalize(smx_context_factory_t *factory)
 { 
+#ifdef CONTEXT_THREADS
   if(parmap)
     xbt_parmap_destroy(parmap);
+#endif
   return smx_ctx_base_factory_finalize(factory);
 }
 
@@ -104,7 +105,9 @@ smx_ctx_sysv_create_context_sized(size_t size, xbt_main_func_t code,
      otherwise is the context for maestro */
   if (code) {
 
-    xbt_assert2(getcontext(&(context->uc)) == 0,
+    int res;
+    res = getcontext(&(context->uc));
+    xbt_assert2(res == 0,
                 "Error in context saving: %d (%s)", errno,
                 strerror(errno));
 
@@ -209,7 +212,7 @@ void smx_ctx_sysv_runall(xbt_dynar_t processes)
   unsigned int cursor;
 
   xbt_dynar_foreach(processes, cursor, process) {
-    DEBUG2("Schedule item %u of %lu",cursor,xbt_dynar_length(processes));
+    XBT_DEBUG("Schedule item %u of %lu",cursor,xbt_dynar_length(processes));
     smx_ctx_sysv_resume(process->context);
   }
   xbt_dynar_reset(processes);
@@ -228,7 +231,9 @@ void smx_ctx_sysv_resume_parallel(smx_process_t process)
 
 void smx_ctx_sysv_runall_parallel(xbt_dynar_t processes)
 {
+#ifdef CONTEXT_THREADS
   xbt_parmap_apply(parmap, (void_f_pvoid_t)smx_ctx_sysv_resume_parallel, processes);
+#endif
   xbt_dynar_reset(processes);
 }