X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/b5cfb55fb9e7333be3d7540164bc4c31e1059d9c..a539cc1790aed8a1549a6cde5cdddc0876615851:/src/simix/smx_context.cpp diff --git a/src/simix/smx_context.cpp b/src/simix/smx_context.cpp index 4fb8c473ab..6f32bb18b6 100644 --- a/src/simix/smx_context.cpp +++ b/src/simix/smx_context.cpp @@ -5,23 +5,12 @@ /* 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. */ -#include -#include - -#include -#include - -#include -#include -#include -#include - #include "simgrid/modelchecker.h" -#include "simgrid/sg_config.hpp" -#include "smx_private.hpp" #include "src/internal_config.h" -#include "xbt/log.h" -#include "xbt/xbt_os_thread.h" +#include "src/simix/smx_private.hpp" +#include "xbt/config.hpp" + +#include #ifdef _WIN32 #include @@ -112,7 +101,7 @@ void SIMIX_context_mod_init() #endif /* select the context factory to use to create the contexts */ - if (simgrid::kernel::context::factory_initializer) { // Give Java a chance to hijack the factory mechanism + if (simgrid::kernel::context::factory_initializer != nullptr) { // Give Java a chance to hijack the factory mechanism simix_global->context_factory = simgrid::kernel::context::factory_initializer(); return; } @@ -259,8 +248,8 @@ int SIMIX_context_get_nthreads() { */ void SIMIX_context_set_nthreads(int nb_threads) { if (nb_threads<=0) { - nb_threads = xbt_os_get_numcores(); - XBT_INFO("Auto-setting contexts/nthreads to %d",nb_threads); + nb_threads = std::thread::hardware_concurrency(); + XBT_INFO("Auto-setting contexts/nthreads to %d", nb_threads); } #if !HAVE_THREAD_CONTEXTS xbt_assert(nb_threads == 1, "Parallel runs are impossible when the pthreads are missing.");