using s4u_VM = simgrid::s4u::VirtualMachine;
using smx_timer_t = simgrid::kernel::timer::Timer*;
-using smx_actor_t = simgrid::kernel::actor::ActorImpl*;
+using smx_actor_t
+ XBT_ATTRIB_DEPRECATED_v335("Please use simgrid::kernel::actor::ActorImpl*") = simgrid::kernel::actor::ActorImpl*;
using smx_activity_t = simgrid::kernel::activity::ActivityImpl*;
using smx_cond_t = simgrid::kernel::activity::ConditionVariableImpl*;
using smx_mailbox_t = simgrid::kernel::activity::MailboxImpl*;
typedef struct s4u_VM s4u_VM;
typedef struct s_smx_timer* smx_timer_t;
-typedef struct s_smx_actor* smx_actor_t;
+XBT_ATTRIB_DEPRECATED_v335("Please stop using this type alias") typedef struct s_smx_actor* smx_actor_t;
typedef struct s_smx_activity* smx_activity_t;
typedef struct s_smx_cond_t* smx_cond_t;
typedef struct s_smx_mailbox* smx_mailbox_t;
/********************************* Process ************************************/
SG_BEGIN_DECL
-XBT_ATTRIB_DEPRECATED_v333("Please use kernel::actor::ActorImpl::self()") XBT_PUBLIC smx_actor_t SIMIX_process_self();
+XBT_ATTRIB_DEPRECATED_v333("Please use kernel::actor::ActorImpl::self()") XBT_PUBLIC
+#ifdef __cplusplus
+ simgrid::kernel::actor::ActorImpl*
+#else
+ smx_actor_t
+#endif
+ SIMIX_process_self();
XBT_ATTRIB_DEPRECATED_v333("Please use xbt_procname()") XBT_PUBLIC const char* SIMIX_process_self_get_name();
SG_END_DECL
/************************** Communication simcalls ****************************/
XBT_ATTRIB_DEPRECATED_v335("Please use s4u::Comm::send()") XBT_PUBLIC
- void simcall_comm_send(smx_actor_t sender, smx_mailbox_t mbox, double task_size, double rate, void* src_buff,
- size_t src_buff_size, bool (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
+ void simcall_comm_send(simgrid::kernel::actor::ActorImpl* sender, smx_mailbox_t mbox, double task_size, double rate,
+ void* src_buff, size_t src_buff_size,
+ bool (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
void (*copy_data_fun)(simgrid::kernel::activity::CommImpl*, void*, size_t), void* data,
double timeout);
XBT_ATTRIB_DEPRECATED_v335("Please use s4u::Comm::isend()") XBT_PUBLIC simgrid::kernel::activity::ActivityImplPtr
- simcall_comm_isend(smx_actor_t sender, smx_mailbox_t mbox, double task_size, double rate, void* src_buff,
- size_t src_buff_size, bool (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
- void (*clean_fun)(void*),
+ simcall_comm_isend(simgrid::kernel::actor::ActorImpl* sender, smx_mailbox_t mbox, double task_size, double rate,
+ void* src_buff, size_t src_buff_size,
+ bool (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*), void (*clean_fun)(void*),
void (*copy_data_fun)(simgrid::kernel::activity::CommImpl*, void*, size_t), void* data,
bool detached);
XBT_ATTRIB_DEPRECATED_v335("Please use s4u::Comm::recv()") XBT_PUBLIC
- void simcall_comm_recv(smx_actor_t receiver, smx_mailbox_t mbox, void* dst_buff, size_t* dst_buff_size,
- bool (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
+ void simcall_comm_recv(simgrid::kernel::actor::ActorImpl* receiver, smx_mailbox_t mbox, void* dst_buff,
+ size_t* dst_buff_size, bool (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
void (*copy_data_fun)(simgrid::kernel::activity::CommImpl*, void*, size_t), void* data,
double timeout, double rate);
XBT_ATTRIB_DEPRECATED_v335("Please use s4u::Comm::irecv()") XBT_PUBLIC simgrid::kernel::activity::ActivityImplPtr
- simcall_comm_irecv(smx_actor_t receiver, smx_mailbox_t mbox, void* dst_buff, size_t* dst_buff_size,
- bool (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
+ simcall_comm_irecv(simgrid::kernel::actor::ActorImpl* receiver, smx_mailbox_t mbox, void* dst_buff,
+ size_t* dst_buff_size, bool (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
void (*copy_data_fun)(simgrid::kernel::activity::CommImpl*, void*, size_t), void* data,
double rate);
SerialThreadContext::run_all(actors);
}
-JavaContext::JavaContext(std::function<void()>&& code, smx_actor_t actor)
+JavaContext::JavaContext(std::function<void()>&& code, actor::ActorImpl* actor)
: SerialThreadContext(std::move(code), actor, false /* not maestro */)
{
/* ThreadContext already does all we need */
auto actor_code = [jprocess]() { simgrid::kernel::context::java_main_jprocess(jprocess); };
auto self = simgrid::kernel::actor::ActorImpl::self();
sg_host_t host = jhost_get_native(env, jhost);
- smx_actor_t actor = simgrid::kernel::actor::simcall_answered([name, actor_code, host, self] {
+ auto* actor = simgrid::kernel::actor::simcall_answered([name, actor_code, host, self] {
return simgrid::kernel::actor::ActorImpl::create(std::move(name), std::move(actor_code), nullptr, host, self).get();
});
sg_actor_yield();
*
* @return The SIMIX process
*/
-smx_actor_t SIMIX_process_self() // XBT_ATTRIB_DEPRECATED_v333
+simgrid::kernel::actor::ActorImpl* SIMIX_process_self() // XBT_ATTRIB_DEPRECATED_v333
{
return simgrid::kernel::actor::ActorImpl::self();
}
XBT_DECLARE_ENUM_CLASS(Type, NONE, RUN_ANSWERED, RUN_BLOCKING);
Type call_ = Type::NONE;
- smx_actor_t issuer_ = nullptr;
+ simgrid::kernel::actor::ActorImpl* issuer_ = nullptr;
simgrid::kernel::timer::Timer* timeout_cb_ = nullptr; // Callback to timeouts
simgrid::kernel::actor::SimcallObserver* observer_ = nullptr; // makes that simcall observable by the MC
unsigned int mc_max_consider_ =
/* thread-specific storage for the worker's context */
thread_local SwappedContext* SwappedContext::worker_context_ = nullptr;
-SwappedContext::SwappedContext(std::function<void()>&& code, smx_actor_t actor, SwappedContextFactory* factory)
+SwappedContext::SwappedContext(std::function<void()>&& code, actor::ActorImpl* actor, SwappedContextFactory* factory)
: Context(std::move(code), actor, not code /* maestro if no code */), factory_(*factory)
{
// Save maestro (=first created context) in preparation for run_all
if (is_parallel()) {
// We lazily create the parmap so that all options are actually processed when doing so.
if (parmap_ == nullptr)
- parmap_ = std::make_unique<simgrid::xbt::Parmap<smx_actor_t>>(get_nthreads(), get_parallel_mode());
+ parmap_ = std::make_unique<simgrid::xbt::Parmap<actor::ActorImpl*>>(get_nthreads(), get_parallel_mode());
// Usually, Parmap::apply() executes the provided function on all elements of the array.
// Here, the executed function does not return the control to the parmap before all the array is processed:
SwappedContext* next_context;
if (is_parallel()) {
// Get some more work to directly swap into the next executable actor instead of yielding back to the parmap
- boost::optional<smx_actor_t> next_work = factory_.parmap_->next();
+ boost::optional<actor::ActorImpl*> next_work = factory_.parmap_->next();
if (next_work) {
// There is a next soul to embody (ie, another executable actor)
XBT_DEBUG("Run next process");
void SerialThreadContext::run_all(std::vector<actor::ActorImpl*> const& actors_list)
{
- for (smx_actor_t const& actor : actors_list) {
+ for (auto const* actor : actors_list) {
XBT_DEBUG("Handling %p", actor);
auto* context = static_cast<ThreadContext*>(actor->context_.get());
context->release();
void ParallelThreadContext::run_all(std::vector<actor::ActorImpl*> const& actors_list)
{
- for (smx_actor_t const& actor : actors_list)
+ for (auto const* actor : actors_list)
static_cast<ThreadContext*>(actor->context_.get())->release();
- for (smx_actor_t const& actor : actors_list)
+ for (auto const* actor : actors_list)
static_cast<ThreadContext*>(actor->context_.get())->wait();
}
* This is controlled in the is_enabled() method of the corresponding observers.
*/
// Called from both MCer and MCed:
-bool actor_is_enabled(smx_actor_t actor)
+bool actor_is_enabled(kernel::actor::ActorImpl* actor)
{
#if SIMGRID_HAVE_MC
xbt_assert(mc_model_checker == nullptr, "This should be called from the client side");
* have both a source and a destination yet is not enabled
* (unless timeout is enabled in the wait and enabled in SimGridMC).
*/
-XBT_PRIVATE bool actor_is_enabled(smx_actor_t process);
+XBT_PRIVATE bool actor_is_enabled(kernel::actor::ActorImpl* process);
/** Check if the given simcall is visible */
XBT_PRIVATE bool request_is_visible(const kernel::actor::Simcall* req);
/** Load the remote list of processes into a vector
*
* @param process MCed process
- * @param target Local vector (to be filled with copies of `s_smx_actor_t`)
+ * @param target Local vector (to be filled with `simgrid::mc::ActorInformation`)
* @param remote_dynar Address of the process dynar in the remote list
*/
static void MC_process_refresh_simix_actor_dynar(const simgrid::mc::RemoteProcess* process,
s_xbt_dynar_t dynar;
process->read_bytes(&dynar, sizeof(dynar), remote_dynar);
- auto* data = static_cast<smx_actor_t*>(::operator new(dynar.elmsize * dynar.used));
+ auto* data = static_cast<simgrid::kernel::actor::ActorImpl**>(::operator new(dynar.elmsize * dynar.used));
process->read_bytes(data, dynar.elmsize * dynar.used, simgrid::mc::RemotePtr<void>(dynar.data));
// Load each element of the vector from the MCed process:
xbt_dict_free(&properties);
/* Let's create the actor: SIMIX may decide to start it right now, even before returning the flow control to us */
- smx_actor_t actor = nullptr;
+ simgrid::kernel::actor::ActorImpl* actor = nullptr;
try {
actor = simgrid::kernel::actor::ActorImpl::attach(name, data, host).get();
actor->set_properties(props);
/**
* @ingroup simix_comm_management
*/
-void simcall_comm_send(smx_actor_t sender, smx_mailbox_t mbox, double task_size, double rate, void* src_buff,
- size_t src_buff_size, bool (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
+void simcall_comm_send(simgrid::kernel::actor::ActorImpl* sender, smx_mailbox_t mbox, double task_size, double rate,
+ void* src_buff, size_t src_buff_size,
+ bool (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
void (*copy_data_fun)(simgrid::kernel::activity::CommImpl*, void*, size_t), void* data,
double timeout) // XBT_ATTRIB_DEPRECATED_v335
{
* @ingroup simix_comm_management
*/
simgrid::kernel::activity::ActivityImplPtr
-simcall_comm_isend(smx_actor_t sender, smx_mailbox_t mbox, double task_size, double rate, void* src_buff,
- size_t src_buff_size, bool (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
- void (*clean_fun)(void*), void (*copy_data_fun)(simgrid::kernel::activity::CommImpl*, void*, size_t),
- void* data, bool detached) // XBT_ATTRIB_DEPRECATED_v335
+simcall_comm_isend(simgrid::kernel::actor::ActorImpl* sender, smx_mailbox_t mbox, double task_size, double rate,
+ void* src_buff, size_t src_buff_size,
+ bool (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*), void (*clean_fun)(void*),
+ void (*copy_data_fun)(simgrid::kernel::activity::CommImpl*, void*, size_t), void* data,
+ bool detached) // XBT_ATTRIB_DEPRECATED_v335
{
/* checking for infinite values */
xbt_assert(std::isfinite(task_size), "task_size is not finite!");
/**
* @ingroup simix_comm_management
*/
-void simcall_comm_recv(smx_actor_t receiver, smx_mailbox_t mbox, void* dst_buff, size_t* dst_buff_size,
- bool (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
+void simcall_comm_recv(simgrid::kernel::actor::ActorImpl* receiver, smx_mailbox_t mbox, void* dst_buff,
+ size_t* dst_buff_size, bool (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
void (*copy_data_fun)(simgrid::kernel::activity::CommImpl*, void*, size_t), void* data,
double timeout, double rate) // XBT_ATTRIB_DEPRECATED_v335
{
* @ingroup simix_comm_management
*/
simgrid::kernel::activity::ActivityImplPtr
-simcall_comm_irecv(smx_actor_t receiver, smx_mailbox_t mbox, void* dst_buff, size_t* dst_buff_size,
- bool (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
+simcall_comm_irecv(simgrid::kernel::actor::ActorImpl* receiver, smx_mailbox_t mbox, void* dst_buff,
+ size_t* dst_buff_size, bool (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
void (*copy_data_fun)(simgrid::kernel::activity::CommImpl*, void*, size_t), void* data,
double rate) // XBT_ATTRIB_DEPRECATED_v335
{