/* */
/* This is somehow the "libc" of SimGrid */
-/* Copyright (c) 2010-2015. The SimGrid Team.
- * All rights reserved. */
+/* Copyright (c) 2010-2017. 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. */
#include "simgrid/s4u/VirtualMachine.hpp"
#include "simgrid/simix.hpp"
#include "simgrid/simix/blocking_simcall.hpp"
-#include "smx_private.h"
+#include "smx_private.hpp"
#include "src/kernel/activity/CommImpl.hpp"
#include "src/mc/mc_forward.hpp"
-#include "src/mc/mc_replay.h"
+#include "src/mc/mc_replay.hpp"
#include "src/plugins/vm/VirtualMachineImpl.hpp"
-#include "src/simix/smx_host_private.h"
+#include "src/simix/smx_host_private.hpp"
#include "xbt/ex.h"
#include "xbt/functional.hpp"
void simcall_call(smx_actor_t actor)
{
if (actor != simix_global->maestro_process) {
- XBT_DEBUG("Yield actor '%s' on simcall %s (%d)", actor->cname(), SIMIX_simcall_name(actor->simcall.call),
+ XBT_DEBUG("Yield actor '%s' on simcall %s (%d)", actor->getCname(), SIMIX_simcall_name(actor->simcall.call),
(int)actor->simcall.call);
SIMIX_process_yield(actor);
} else {
*/
void simcall_execution_cancel(smx_activity_t execution)
{
- simcall_BODY_execution_cancel(execution);
+ simgrid::simix::kernelImmediate([execution] {
+ XBT_DEBUG("Cancel synchro %p", execution.get());
+ simgrid::kernel::activity::ExecImplPtr exec =
+ boost::static_pointer_cast<simgrid::kernel::activity::ExecImpl>(execution);
+
+ if (exec->surf_exec)
+ exec->surf_exec->cancel();
+ });
}
/**
{
/* checking for infinite values */
xbt_assert(std::isfinite(priority), "priority is not finite!");
+ simgrid::simix::kernelImmediate([execution, priority] {
- simcall_BODY_execution_set_priority(execution, priority);
+ simgrid::kernel::activity::ExecImplPtr exec =
+ boost::static_pointer_cast<simgrid::kernel::activity::ExecImpl>(execution);
+ if (exec->surf_exec)
+ exec->surf_exec->setSharingWeight(priority);
+ });
}
/**
*/
void simcall_execution_set_bound(smx_activity_t execution, double bound)
{
- simcall_BODY_execution_set_bound(execution, bound);
+ simgrid::simix::kernelImmediate([execution, bound] {
+ simgrid::kernel::activity::ExecImplPtr exec =
+ boost::static_pointer_cast<simgrid::kernel::activity::ExecImpl>(execution);
+ if (exec->surf_exec)
+ static_cast<simgrid::surf::CpuAction*>(exec->surf_exec)->setBound(bound);
+ });
}
/**
return (e_smx_state_t) simcall_BODY_execution_wait(execution);
}
-/**
- * \ingroup simix_process_management
- * \brief Kills a SIMIX process.
- *
- * This function simply kills a process.
- *
- * \param process poor victim
- */
-void simcall_process_kill(smx_actor_t process)
-{
- simcall_BODY_process_kill(process);
-}
-
/**
* \ingroup simix_process_management
* \brief Kills all SIMIX processes.
if (kill_time <= SIMIX_get_clock() || simix_global->kill_process_function == nullptr)
return;
- XBT_DEBUG("Set kill time %f for process %s@%s", kill_time, process->cname(), process->host->getCname());
- process->kill_timer = SIMIX_timer_set(kill_time, [=] {
+ XBT_DEBUG("Set kill time %f for process %s@%s", kill_time, process->getCname(), process->host->getCname());
+ process->kill_timer = SIMIX_timer_set(kill_time, [process] {
simix_global->kill_process_function(process);
process->kill_timer=nullptr;
});
}
-/**
- * \ingroup simix_process_management
- * \brief Return the properties
- *
- * This function returns the properties associated with this process
- */
-xbt_dict_t simcall_process_get_properties(smx_actor_t process)
-{
- return process->properties;
-}
/**
* \ingroup simix_process_management
* \brief Add an on_exit function
* \ingroup simix_synchro_management
*
*/
-void simcall_cond_wait_timeout(smx_cond_t cond,
- smx_mutex_t mutex,
- double timeout)
+void simcall_cond_wait_timeout(smx_cond_t cond, smx_mutex_t mutex, double timeout)
{
xbt_assert(std::isfinite(timeout), "timeout is not finite!");
simcall_BODY_cond_wait_timeout(cond, mutex, timeout);
simcall_BODY_sem_acquire_timeout(sem, timeout);
}
-/**
- * \ingroup simix_file_management
- *
- */
-sg_size_t simcall_file_read(surf_file_t fd, sg_size_t size)
+sg_size_t simcall_storage_read(surf_storage_t st, sg_size_t size)
{
- return simcall_BODY_file_read(fd, size);
+ return simcall_BODY_storage_read(st, size);
}
-/**
- * \ingroup simix_file_management
- *
- */
-sg_size_t simcall_file_write(surf_file_t fd, sg_size_t size)
+sg_size_t simcall_storage_write(surf_storage_t st, sg_size_t size)
{
- return simcall_BODY_file_write(fd, size);
+ return simcall_BODY_storage_write(st, size);
}
void simcall_run_kernel(std::function<void()> const& code)