#include "simgrid/Exception.hpp"
#include "src/internal_config.h" /* loads context system definitions */
#include "src/kernel/EngineImpl.hpp"
-#include "src/simix/smx_private.hpp"
#include "xbt/function_types.h"
#include "xbt/xbt_modinter.h" /* prototype of os thread module's init/exit in XBT */
ThreadContextFactory::ThreadContextFactory() : ContextFactory()
{
- if (smx_context_stack_size != 8 * 1024 * 1024)
+ if (stack_size != 8 * 1024 * 1024)
XBT_INFO("Stack size modifications are ignored by thread factory.");
- if (SIMIX_context_is_parallel())
+ if (is_parallel())
ParallelThreadContext::initialize();
}
ThreadContextFactory::~ThreadContextFactory()
{
- if (SIMIX_context_is_parallel())
+ if (is_parallel())
ParallelThreadContext::finalize();
}
ThreadContext* ThreadContextFactory::create_context(std::function<void()>&& code, actor::ActorImpl* actor, bool maestro)
{
- if (SIMIX_context_is_parallel())
+ if (is_parallel())
return this->new_context<ParallelThreadContext>(std::move(code), actor, maestro);
else
return this->new_context<SerialThreadContext>(std::move(code), actor, maestro);
void ThreadContextFactory::run_all()
{
- if (SIMIX_context_is_parallel()) {
+ if (is_parallel()) {
// Parallel execution
ParallelThreadContext::run_all();
} else {
void ParallelThreadContext::initialize()
{
- thread_sem_ = new xbt::OsSemaphore(SIMIX_context_get_nthreads());
+ thread_sem_ = new xbt::OsSemaphore(get_nthreads());
}
void ParallelThreadContext::finalize()