X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/10ceac5fd14fb0426b5c93bda85676a79b02d0be..d6d03a0a88c2673c9e5c604d63912b77bc17fdd4:/src/kernel/context/ContextUnix.cpp diff --git a/src/kernel/context/ContextUnix.cpp b/src/kernel/context/ContextUnix.cpp index 550172e6ce..f2f99a6d2a 100644 --- a/src/kernel/context/ContextUnix.cpp +++ b/src/kernel/context/ContextUnix.cpp @@ -1,20 +1,16 @@ -/* Copyright (c) 2009-2015. The SimGrid Team. - * All rights reserved. */ +/* Copyright (c) 2009-2015. The SimGrid Team. All rights 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. */ -/* \file UContext.cpp Context switching with ucontexts from System V */ +/* \file UContext.cpp Context switching with ucontexts from System V */ -#include - -#include #include /* context relative declarations */ -#include "xbt/parmap.h" -#include "src/simix/smx_private.h" -#include "src/internal_config.h" #include "mc/mc.h" +#include "src/simix/ActorImpl.hpp" +#include "src/simix/smx_private.h" +#include "xbt/parmap.h" /** Many integers are needed to store a pointer * @@ -161,7 +157,7 @@ UContextFactory::~UContextFactory() void UContextFactory::run_all() { if (sysv_parallel) { - #if HAVE_THREAD_CONTEXTS +#if HAVE_THREAD_CONTEXTS sysv_threads_working = 0; // Parmap_apply ensures that every working thread get an index in the // process_to_run array (through an atomic fetch_and_add), @@ -181,19 +177,17 @@ void UContextFactory::run_all() context->resume(); }, simix_global->process_to_run); - #else +#else xbt_die("You asked for a parallel execution, but you don't have any threads."); - #endif +#endif } else { // Serial: if (xbt_dynar_is_empty(simix_global->process_to_run)) return; - smx_actor_t first_process = - xbt_dynar_get_as(simix_global->process_to_run, 0, smx_actor_t); + smx_actor_t first_process = xbt_dynar_get_as(simix_global->process_to_run, 0, smx_actor_t); sysv_process_index = 1; - SerialUContext* context = - static_cast(first_process->context); + SerialUContext* context = static_cast(first_process->context); context->resume(); } } @@ -224,7 +218,7 @@ UContext::UContext(std::function code, sysv_maestro_context = this; } -#if HAVE_MC +#if SIMGRID_HAVE_MC if (MC_is_active() && has_code()) { MC_register_stack_area(this->stack_, process, &(this->uc_), smx_context_usable_stack_size); @@ -279,8 +273,7 @@ void SerialUContext::suspend() XBT_DEBUG("Run next process"); next_context = (SerialUContext*) xbt_dynar_get_as( simix_global->process_to_run,i, smx_actor_t)->context; - } - else { + } else { /* all processes were run, return to maestro */ XBT_DEBUG("No more process to run"); next_context = (SerialUContext*) sysv_maestro_context; @@ -359,8 +352,7 @@ void ParallelUContext::suspend() // There is a next soul to embody (ie, a next process to resume) XBT_DEBUG("Run next process"); next_context = (ParallelUContext*) next_work->context; - } - else { + } else { // All processes were run, go to the barrier XBT_DEBUG("No more processes to run"); // Get back the identity of my body that was stored when starting