} catch (simgrid::TimeoutError& e) {
comm->status = MSG_TIMEOUT;
finished = true;
+ } catch (simgrid::CancelException& e) {
+ comm->status = MSG_HOST_FAILURE;
+ finished = true;
}
catch (xbt_ex& e) {
if (e.category == network_error) {
} catch (simgrid::TimeoutError& e) {
finished_index = e.value;
status = MSG_TIMEOUT;
+ } catch (simgrid::CancelException& e) {
+ finished_index = e.value;
+ status = MSG_HOST_FAILURE;
}
catch (xbt_ex& e) {
if (e.category != network_error)
/* FIXME: these functions are not traceable */
} catch (simgrid::TimeoutError& e) {
comm->status = MSG_TIMEOUT;
+ } catch (simgrid::CancelException& e) {
+ comm->status = MSG_HOST_FAILURE;
}
catch (xbt_ex& e) {
if (e.category == network_error)
} catch (simgrid::TimeoutError& e) {
finished_index = e.value;
status = MSG_TIMEOUT;
+ } catch (simgrid::CancelException& e) {
+ finished_index = e.value;
+ status = MSG_HOST_FAILURE;
}
catch(xbt_ex& e) {
if (e.category == network_error) {
#include "src/msg/msg_private.hpp"
#include "xbt/log.h"
+#include "simgrid/Exception.hpp"
#include "simgrid/s4u/Comm.hpp"
#include "simgrid/s4u/Mailbox.hpp"
return this;
case State::CANCELED:
- return this;
+ throw CancelException(XBT_THROW_POINT, "Communication canceled");
+
default:
THROW_IMPOSSIBLE;
}
msg_comm_t comm = MSG_task_isend(task, "worker_mailbox");
XBT_INFO("Canceling task \"%s\" during comm", task->name);
MSG_task_cancel(task);
- try {
- MSG_comm_wait(comm, -1);
- }
- catch (xbt_ex& ex) {
+ if (MSG_comm_wait(comm, -1) != MSG_OK)
MSG_comm_destroy(comm);
- }
MSG_task_destroy(task);
task = MSG_task_create("finalize", task_comp_size, task_comm_size, NULL);
comm = MSG_task_isend(task, "worker_mailbox");
XBT_INFO("Destroying task \"%s\" during comm", task->name);
MSG_task_destroy(task);
- try {
- MSG_comm_wait(comm, -1);
- }
- catch (xbt_ex& ex) {
+ if (MSG_comm_wait(comm, -1) != MSG_OK)
MSG_comm_destroy(comm);
- }
task = MSG_task_create("cancel", task_comp_size, task_comm_size, NULL);
MSG_task_send_with_timeout(task, "worker_mailbox", timeout);