/** @brief Simulation Agent (see \ref s4u_actor)*/
XBT_PUBLIC_CLASS Actor {
+ friend Mailbox;
+
private:
/** Wrap a (possibly non-copyable) single-use task into a `std::function` */
template<class F, class... Args>
static void killAll();
bool valid() const { return pimpl_ != nullptr; }
-
+
+ smx_process_t getInferior();
private:
smx_process_t pimpl_ = nullptr;
};
* It means that the communications sent to this mailbox will start flowing to its host even before he does a recv().
* This models the real behavior of TCP and MPI communications, amongst other.
*/
- void setReceiver(smx_process_t process);
+ void setReceiver(Actor process);
/** Return the process declared as permanent receiver, or nullptr if none **/
- smx_process_t receiver();
+ Actor receiver();
private:
std::string name_;
return nullptr == simcall_mbox_front(pimpl_);
}
-void Mailbox::setReceiver(smx_process_t process) {
- simcall_mbox_set_receiver(pimpl_, process);
+void Mailbox::setReceiver(Actor actor) {
+ simcall_mbox_set_receiver(pimpl_, actor.pimpl_);
}
/** @brief get the receiver (process associated to the mailbox) */
-smx_process_t Mailbox::receiver() {
- return pimpl_->permanent_receiver;
+Actor Mailbox::receiver() {
+ return Actor(pimpl_->permanent_receiver);
}
}
mbox->setReceiver(process);
}
smx_process_t sg_mbox_receiver(sg_mbox_t mbox) {
- return mbox->receiver();
+ return mbox->receiver().getInferior();
}