It uses the `simgrid::simix::Process` as an opaque pimple:
-~~~
-class Process {
-private:
- std::atomic_int_fast32_t refcount_ { 1 };
- // The lifetime of the s4u::Actor is bound to the lifetime of the Process:
- simgrid::s4u::Actor actor_;
-public:
- Process() : actor_(this) {}
-
- // Reference count:
- friend void intrusive_ptr_add_ref(Process* process)
- {
- // Atomic operation! Do not split in two instructions!
- auto previous = (process->refcount_)++;
- xbt_assert(previous != 0);
- (void) previous;
- }
- friend void intrusive_ptr_release(Process* process)
- {
- // Atomic operation! Do not split in two instructions!
- auto count = --(process->refcount_);
- if (count == 0)
- delete process;
- }
-
- // [...]
-};
-
-smx_process_t SIMIX_process_ref(smx_process_t process)
-{
- if (process != nullptr)
- intrusive_ptr_add_ref(process);
- return process;
-}
-
-/** Decrease the refcount for this process */
-void SIMIX_process_unref(smx_process_t process)
-{
- if (process != nullptr)
- intrusive_ptr_release(process);
-}
-~~~
@section simgrid_uhood_mc Model Checker
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(ker_simcall, kernel, "transmuting from user request into kernel handlers");
-/**
- * @ingroup simix_comm_management
- */
void simcall_comm_send(simgrid::kernel::actor::ActorImpl* sender, simgrid::kernel::activity::MailboxImpl* mbox,
double task_size, double rate, void* src_buff, size_t src_buff_size,
bool (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
copy_data_fun, data, timeout);
}
-/**
- * @ingroup simix_comm_management
- */
simgrid::kernel::activity::ActivityImplPtr
simcall_comm_isend(simgrid::kernel::actor::ActorImpl* sender, simgrid::kernel::activity::MailboxImpl* mbox,
double task_size, double rate, void* src_buff, size_t src_buff_size,
[&observer] { return simgrid::kernel::activity::CommImpl::isend(&observer); });
}
-/**
- * @ingroup simix_comm_management
- */
void simcall_comm_recv(simgrid::kernel::actor::ActorImpl* receiver, simgrid::kernel::activity::MailboxImpl* mbox,
void* dst_buff, size_t* dst_buff_size,
bool (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
timeout, rate);
}
-/**
- * @ingroup simix_comm_management
- */
simgrid::kernel::activity::ActivityImplPtr
simcall_comm_irecv(simgrid::kernel::actor::ActorImpl* receiver, simgrid::kernel::activity::MailboxImpl* mbox,
void* dst_buff, size_t* dst_buff_size,
[&observer] { return simgrid::kernel::activity::CommImpl::irecv(&observer); });
}
-/**
- * @ingroup simix_comm_management
- */
ssize_t simcall_comm_waitany(simgrid::kernel::activity::CommImpl* comms[], size_t count,
double timeout) // XBT_ATTRIB_DEPRECATED_v335
{
return changed_pos;
}
-/**
- * @ingroup simix_comm_management
- */
ssize_t simcall_comm_testany(simgrid::kernel::activity::CommImpl* comms[], size_t count) // XBT_ATTRIB_DEPRECATED_v335
{
if (count == 0)
return changed_pos;
}
-/**
- * @ingroup simix_comm_management
- */
void simcall_comm_wait(simgrid::kernel::activity::ActivityImpl* comm, double timeout) // XBT_ATTRIB_DEPRECATED_v335
{
xbt_assert(std::isfinite(timeout), "timeout is not finite!");
simgrid::kernel::actor::simcall_blocking([issuer, comm, timeout] { comm->wait_for(issuer, timeout); });
}
-/**
- * @ingroup simix_comm_management
- *
- */
bool simcall_comm_test(simgrid::kernel::activity::ActivityImpl* comm) // XBT_ATTRIB_DEPRECATED_v335
{
simgrid::kernel::actor::ActorImpl* issuer = simgrid::kernel::actor::ActorImpl::self();