Along with the deprecation wrappers, and in all subclasses also.
simgrid::s4u::CommPtr comm = return_mailbox->get_async(&data);
try {
simgrid::s4u::CommPtr comm = return_mailbox->get_async(&data);
try {
+ comm->wait_for(timeout);
XBT_DEBUG("Received the answer to my 'Predecessor Alive': my predecessor %d is alive", pred_id_);
delete static_cast<ChordMessage*>(data);
} catch (xbt_ex& e) {
XBT_DEBUG("Received the answer to my 'Predecessor Alive': my predecessor %d is alive", pred_id_);
delete static_cast<ChordMessage*>(data);
} catch (xbt_ex& e) {
simgrid::s4u::CommPtr comm = return_mailbox->get_async(&data);
try {
simgrid::s4u::CommPtr comm = return_mailbox->get_async(&data);
try {
+ comm->wait_for(timeout);
ChordMessage* answer = static_cast<ChordMessage*>(data);
XBT_DEBUG("Received the answer to my 'Get Predecessor' request: the predecessor of node %d is %d", ask_to,
answer->answer_id);
ChordMessage* answer = static_cast<ChordMessage*>(data);
XBT_DEBUG("Received the answer to my 'Get Predecessor' request: the predecessor of node %d is %d", ask_to,
answer->answer_id);
simgrid::s4u::CommPtr comm = return_mailbox->get_async(&data);
try {
simgrid::s4u::CommPtr comm = return_mailbox->get_async(&data);
try {
+ comm->wait_for(timeout);
ChordMessage* answer = static_cast<ChordMessage*>(data);
XBT_DEBUG("Received the answer to my 'Find Successor' request for id %d: the successor of key %d is %d",
answer->request_id, id_, answer->answer_id);
ChordMessage* answer = static_cast<ChordMessage*>(data);
XBT_DEBUG("Received the answer to my 'Find Successor' request for id %d: the successor of key %d is %d",
answer->request_id, id_, answer->answer_id);
virtual Activity* wait() = 0;
/** Blocks until the activity is terminated, or until the timeout is elapsed
* Raises: timeout exception.*/
virtual Activity* wait() = 0;
/** Blocks until the activity is terminated, or until the timeout is elapsed
* Raises: timeout exception.*/
- virtual Activity* wait(double timeout) = 0;
+ virtual Activity* wait_for(double timeout) = 0;
/** Cancel that activity */
virtual Activity* cancel() = 0;
/** Retrieve the current state of the activity */
/** Cancel that activity */
virtual Activity* cancel() = 0;
/** Retrieve the current state of the activity */
void* get_user_data() { return user_data_; }
#ifndef DOXYGEN
void* get_user_data() { return user_data_; }
#ifndef DOXYGEN
- /** @deprecated See Activity::get_state()*/
+ XBT_ATTRIB_DEPRECATED_v324("Please use Activity::wait_for()") virtual void wait(double timeout) = 0;
XBT_ATTRIB_DEPRECATED_v323("Please use Activity::get_state()") Activity::State getState() { return state_; }
XBT_ATTRIB_DEPRECATED_v323("Please use Activity::get_state()") Activity::State getState() { return state_; }
- /** @deprecated See Activity::get_remaining() */
XBT_ATTRIB_DEPRECATED_v323("Please use Activity::get_remaining()") double getRemains() { return get_remaining(); }
XBT_ATTRIB_DEPRECATED_v323("Please use Activity::get_remaining()") double getRemains() { return get_remaining(); }
- /** @deprecated See Activity::set_remaining() */
XBT_ATTRIB_DEPRECATED_v323("Please use Activity::set_remaining()") Activity* setRemains(double remains)
{
return set_remaining(remains);
}
XBT_ATTRIB_DEPRECATED_v323("Please use Activity::set_remaining()") Activity* setRemains(double remains)
{
return set_remaining(remains);
}
- /** @deprecated See Activity::set_user_data() */
XBT_ATTRIB_DEPRECATED_v323("Please use Activity::set_user_data()") Activity* setUserData(void* data)
{
return set_user_data(data);
}
XBT_ATTRIB_DEPRECATED_v323("Please use Activity::set_user_data()") Activity* setUserData(void* data)
{
return set_user_data(data);
}
- /** @deprecated See Activity::get_user_data() */
XBT_ATTRIB_DEPRECATED_v323("Please use Activity::get_user_data()") void* getUserData() { return user_data_; }
#endif
XBT_ATTRIB_DEPRECATED_v323("Please use Activity::get_user_data()") void* getUserData() { return user_data_; }
#endif
Activity* start() override;
Activity* wait() override;
Activity* start() override;
Activity* wait() override;
- Activity* wait(double timeout) override;
+ Activity* wait_for(double timeout) override;
bool test() override;
/** Start the comm, and ignore its result. It can be completely forgotten after that. */
bool test() override;
/** Start the comm, and ignore its result. It can be completely forgotten after that. */
MailboxPtr get_mailbox();
#ifndef DOXYGEN
MailboxPtr get_mailbox();
#ifndef DOXYGEN
- /** @deprecated See Comm::set_rate() */
+ XBT_ATTRIB_DEPRECATED_v324("Please use Comm::wait_for()") void wait(double t) override { wait_for(t); }
XBT_ATTRIB_DEPRECATED_v323("Please use Comm::set_rate()") Activity* setRate(double rate) { return set_rate(rate); }
XBT_ATTRIB_DEPRECATED_v323("Please use Comm::set_rate()") Activity* setRate(double rate) { return set_rate(rate); }
- /** @deprecated See Comm::set_src_data() */
XBT_ATTRIB_DEPRECATED_v323("Please use Comm::set_src_data()") Activity* setSrcData(void* buff)
{
return set_src_data(buff);
}
XBT_ATTRIB_DEPRECATED_v323("Please use Comm::set_src_data()") Activity* setSrcData(void* buff)
{
return set_src_data(buff);
}
- /** @deprecated See Comm::set_src_data() */
XBT_ATTRIB_DEPRECATED_v323("Please use Comm::set_src_data()") Activity* setSrcData(void* buff, size_t size)
{
return set_src_data(buff, size);
}
XBT_ATTRIB_DEPRECATED_v323("Please use Comm::set_src_data()") Activity* setSrcData(void* buff, size_t size)
{
return set_src_data(buff, size);
}
- /** @deprecated See Comm::set_src_data_size() */
XBT_ATTRIB_DEPRECATED_v323("Please use Comm::set_src_data_size()") Activity* setSrcDataSize(size_t size)
{
return set_src_data_size(size);
}
XBT_ATTRIB_DEPRECATED_v323("Please use Comm::set_src_data_size()") Activity* setSrcDataSize(size_t size)
{
return set_src_data_size(size);
}
- /** @deprecated See Comm::set_dst_data() */
XBT_ATTRIB_DEPRECATED_v323("Please use Comm::set_dst_data()") Activity* setDstData(void** buff)
{
return set_dst_data(buff);
}
XBT_ATTRIB_DEPRECATED_v323("Please use Comm::set_dst_data()") Activity* setDstData(void** buff)
{
return set_dst_data(buff);
}
- /** @deprecated See Comm::set_dst_data() */
XBT_ATTRIB_DEPRECATED_v323("Please use Comm::set_dst_data()") Activity* setDstData(void** buff, size_t size)
{
return set_dst_data(buff, size);
}
XBT_ATTRIB_DEPRECATED_v323("Please use Comm::set_dst_data()") Activity* setDstData(void** buff, size_t size)
{
return set_dst_data(buff, size);
}
- /** @deprecated See Comm::get_dst_data_size() */
XBT_ATTRIB_DEPRECATED_v323("Please use Comm::get_dst_data_size()") size_t getDstDataSize()
{
return get_dst_data_size();
}
XBT_ATTRIB_DEPRECATED_v323("Please use Comm::get_dst_data_size()") size_t getDstDataSize()
{
return get_dst_data_size();
}
- /** @deprecated See Comm::get_mailbox() */
XBT_ATTRIB_DEPRECATED_v323("Please use Comm::get_mailbox()") MailboxPtr getMailbox() { return get_mailbox(); }
#endif
XBT_ATTRIB_DEPRECATED_v323("Please use Comm::get_mailbox()") MailboxPtr getMailbox() { return get_mailbox(); }
#endif
Activity* start() override;
Activity* wait() override;
Activity* start() override;
Activity* wait() override;
- Activity* wait(double timeout) override;
+ Activity* wait_for(double timeout) override;
Activity* cancel() override;
bool test() override;
Activity* cancel() override;
bool test() override;
double get_remaining() override;
double get_remaining_ratio();
double get_remaining() override;
double get_remaining_ratio();
//////////////// Deprecated functions
//////////////// Deprecated functions
- /** @deprecated See Exec::set_priority() */
+ XBT_ATTRIB_DEPRECATED_v324("Please use Exec::wait_for()") void wait(double t) override { wait_for(t); }
XBT_ATTRIB_DEPRECATED_v323("Please use Exec::set_priority()") ExecPtr setPriority(double priority)
{
return set_priority(priority);
}
XBT_ATTRIB_DEPRECATED_v323("Please use Exec::set_priority()") ExecPtr setPriority(double priority)
{
return set_priority(priority);
}
- /** @deprecated See Exec::set_bound() */
XBT_ATTRIB_DEPRECATED_v323("Please use Exec::set_bound()") ExecPtr setBound(double bound) { return set_bound(bound); }
XBT_ATTRIB_DEPRECATED_v323("Please use Exec::set_bound()") ExecPtr setBound(double bound) { return set_bound(bound); }
- /** @deprecated See Exec::set_host() */
XBT_ATTRIB_DEPRECATED_v323("Please use Exec::set_host()") ExecPtr setHost(Host* host) { return set_host(host); }
XBT_ATTRIB_DEPRECATED_v323("Please use Exec::set_host()") ExecPtr setHost(Host* host) { return set_host(host); }
- /** @deprecated See Exec::get_host() */
XBT_ATTRIB_DEPRECATED_v323("Please use Exec::get_host()") Host* getHost() { return get_host(); }
XBT_ATTRIB_DEPRECATED_v323("Please use Exec::get_host()") Host* getHost() { return get_host(); }
- /** @deprecated See Exec::get_remaining_ratio() */
XBT_ATTRIB_DEPRECATED_v323("Please use Exec::get_remaining_ratio()") double getRemainingRatio()
{
return get_remaining_ratio();
}
XBT_ATTRIB_DEPRECATED_v323("Please use Exec::get_remaining_ratio()") double getRemainingRatio()
{
return get_remaining_ratio();
}
private:
Host* host_ = nullptr;
private:
Host* host_ = nullptr;
Activity* start() override;
Activity* wait() override;
Activity* start() override;
Activity* wait() override;
- Activity* wait(double timeout) override;
+ Activity* wait_for(double timeout) override;
Activity* cancel() override;
bool test() override;
double get_remaining() override;
sg_size_t get_performed_ioops();
Activity* cancel() override;
bool test() override;
double get_remaining() override;
sg_size_t get_performed_ioops();
+#ifndef DOXYGEN
+ XBT_ATTRIB_DEPRECATED_v324("Please use Io::wait_for()") void wait(double t) override { wait_for(t); }
+#endif
+
private:
sg_size_t size_ = 0;
sg_storage_t storage_ = nullptr;
private:
sg_size_t size_ = 0;
sg_storage_t storage_ = nullptr;
s4u::Activity* comm = nullptr;
try {
if (mig_speed > 0)
s4u::Activity* comm = nullptr;
try {
if (mig_speed > 0)
- comm = mbox->put_init(msg, size)->set_rate(mig_speed)->wait(timeout);
+ comm = mbox->put_init(msg, size)->set_rate(mig_speed)->wait_for(timeout);
- comm = mbox->put_async(msg, size)->wait();
+ comm = mbox->put_async(msg, size)->wait_for(timeout);
} catch (xbt_ex& e) {
if (comm) {
sg_size_t remaining = static_cast<sg_size_t>(comm->get_remaining());
} catch (xbt_ex& e) {
if (comm) {
sg_size_t remaining = static_cast<sg_size_t>(comm->get_remaining());
/** @brief Block the calling actor until the communication is finished */
Activity* Comm::wait()
{
/** @brief Block the calling actor until the communication is finished */
Activity* Comm::wait()
{
+ return this->wait_for(-1);
}
/** @brief Block the calling actor until the communication is finished, or until timeout
}
/** @brief Block the calling actor until the communication is finished, or until timeout
*
* @param timeout the amount of seconds to wait for the comm termination.
* Negative values denote infinite wait times. 0 as a timeout returns immediately. */
*
* @param timeout the amount of seconds to wait for the comm termination.
* Negative values denote infinite wait times. 0 as a timeout returns immediately. */
-Activity* Comm::wait(double timeout)
+Activity* Comm::wait_for(double timeout)
{
switch (state_) {
case State::FINISHED:
{
switch (state_) {
case State::FINISHED:
-Activity* Exec::wait(double timeout)
+Activity* Exec::wait_for(double timeout)
{
THROW_UNIMPLEMENTED;
return this;
{
THROW_UNIMPLEMENTED;
return this;
-Activity* Io::wait(double timeout)
+Activity* Io::wait_for(double timeout)
{
THROW_UNIMPLEMENTED;
return this;
{
THROW_UNIMPLEMENTED;
return this;
c->set_remaining(simulated_size_in_bytes);
c->set_src_data(payload);
// c->start() is optional.
c->set_remaining(simulated_size_in_bytes);
c->set_src_data(payload);
// c->start() is optional.
}
s4u::CommPtr Mailbox::get_init()
}
s4u::CommPtr Mailbox::get_init()
void* res = nullptr;
CommPtr c = get_init();
c->set_dst_data(&res, sizeof(res));
void* res = nullptr;
CommPtr c = get_init();
c->set_dst_data(&res, sizeof(res));
return res;
}
} // namespace s4u
return res;
}
} // namespace s4u