Actor(Actor const&) = delete;
Actor& operator=(Actor const&) = delete;
- // ***** Reference count (delegated to pimpl_) *****
- friend void intrusive_ptr_add_ref(Actor* actor)
- {
- xbt_assert(actor != nullptr);
- SIMIX_process_ref(actor->pimpl_);
- }
- friend void intrusive_ptr_release(Actor* actor)
- {
- xbt_assert(actor != nullptr);
- SIMIX_process_unref(actor->pimpl_);
- }
+ // ***** Reference count *****
+ friend void intrusive_ptr_add_ref(Actor * actor);
+ friend void intrusive_ptr_release(Actor * actor);
// ***** Actor creation *****
/** Retrieve a reference to myself */
namespace s4u {
class Actor;
+XBT_PUBLIC(void) intrusive_ptr_release(Actor* actor);
+XBT_PUBLIC(void) intrusive_ptr_add_ref(Actor* actor);
using ActorPtr = boost::intrusive_ptr<Actor>;
class Activity;
XBT_PUBLIC(void*) SIMIX_host_self_get_data();
/********************************* Process ************************************/
-XBT_PUBLIC(smx_actor_t) SIMIX_process_ref(smx_actor_t process);
-XBT_PUBLIC(void) SIMIX_process_unref(smx_actor_t process);
XBT_PUBLIC(int) SIMIX_process_count();
XBT_PUBLIC(smx_actor_t) SIMIX_process_self();
XBT_PUBLIC(const char*) SIMIX_process_self_get_name();
return actor->iface();
}
+void intrusive_ptr_add_ref(Actor* actor)
+{
+ xbt_assert(actor != nullptr);
+ intrusive_ptr_add_ref(actor->pimpl_);
+}
+void intrusive_ptr_release(Actor* actor)
+{
+ xbt_assert(actor != nullptr);
+ intrusive_ptr_release(actor->pimpl_);
+}
+
// ***** Actor methods *****
void Actor::join() {
unsigned long simix_process_maxpid = 0;
-/** Increase the refcount for this process */
-smx_actor_t SIMIX_process_ref(smx_actor_t process)
-{
- if (process != nullptr)
- intrusive_ptr_add_ref(process);
- return process;
-}
-
-/** Decrease the refcount for this process */
-void SIMIX_process_unref(smx_actor_t process)
-{
- if (process != nullptr)
- intrusive_ptr_release(process);
-}
-
/**
* \brief Returns the current agent.
*
void* other_user_data = nullptr;
for(auto it = deque->begin(); it != deque->end(); it++){
- smx_activity_t synchro = *it;
simgrid::kernel::activity::CommImplPtr comm =
- boost::dynamic_pointer_cast<simgrid::kernel::activity::CommImpl>(std::move(synchro));
+ boost::dynamic_pointer_cast<simgrid::kernel::activity::CommImpl>(std::move(*it));
if (comm->type == SIMIX_COMM_SEND) {
other_user_data = comm->src_data;
comm->mbox_cpy = comm->mbox;
#endif
comm->mbox = nullptr;
- return comm;
+ return std::move(comm);
}
XBT_DEBUG("Sorry, communication synchro %p does not match our needs:"
" its type is %d but we are looking for a comm of type %d (or maybe the filtering didn't match)",
XBT_DEBUG("We have a comm that has probably already been received, trying to match it, to skip the communication");
//find a match in the list of already received comms
- other_comm = _find_matching_comm(&mbox->done_comm_queue, SIMIX_COMM_SEND, match_fun, data, this_synchro,
- /*remove_matching*/ true);
+ other_comm = std::move(_find_matching_comm(&mbox->done_comm_queue, SIMIX_COMM_SEND, match_fun, data, this_synchro,
+ /*remove_matching*/ true));
//if not found, assume the receiver came first, register it to the mailbox in the classical way
if (not other_comm) {
XBT_DEBUG("We have messages in the permanent receive list, but not the one we are looking for, pushing request into list");