Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Rename simgrid::TimeoutError to simgrid::TimeoutException.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Tue, 2 Jul 2019 14:14:38 +0000 (16:14 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Tue, 2 Jul 2019 14:19:59 +0000 (16:19 +0200)
ChangeLog
doc/doxygen/uhood_switch.doc
examples/s4u/app-bittorrent/s4u-peer.cpp
examples/s4u/dht-chord/s4u-dht-chord-node.cpp
examples/s4u/exec-ptask/s4u-exec-ptask.cpp
examples/s4u/platform-failures/s4u-platform-failures.cpp
include/simgrid/Exception.hpp
src/kernel/activity/CommImpl.cpp
src/kernel/activity/ExecImpl.cpp
src/msg/msg_comm.cpp
src/msg/msg_task.cpp

index 6c43d5f..7659918 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,9 @@ Documentation:
  - Nicer introduction page.
  - Move Java as a subtree of MSG.
 
  - Nicer introduction page.
  - Move Java as a subtree of MSG.
 
+General:
+ - Rename simgrid::TimeoutError to simgrid::TimeoutException.
+
 XBT:
  - Drop xbt_dynar_sort_strings().
 
 XBT:
  - Drop xbt_dynar_sort_strings().
 
index f9b3ad1..b26b315 100644 (file)
@@ -708,7 +708,7 @@ std::cv_status ConditionVariable::wait_for(
     simcall_cond_wait_timeout(cond_, lock.mutex()->mutex_, timeout);
     return std::cv_status::no_timeout;
   }
     simcall_cond_wait_timeout(cond_, lock.mutex()->mutex_, timeout);
     return std::cv_status::no_timeout;
   }
-  catch (const simgrid::TimeoutError& e) {
+  catch (const simgrid::TimeoutException& e) {
     // If the exception was a timeout, we have to take the lock again:
     try {
       lock.mutex()->lock();
     // If the exception was a timeout, we have to take the lock again:
     try {
       lock.mutex()->lock();
index 6d133cc..ff9a094 100644 (file)
@@ -84,7 +84,7 @@ bool Peer::getPeersFromTracker()
   try {
     XBT_DEBUG("Sending a peer request to the tracker.");
     tracker_mailbox->put(peer_request, TRACKER_COMM_SIZE, GET_PEERS_TIMEOUT);
   try {
     XBT_DEBUG("Sending a peer request to the tracker.");
     tracker_mailbox->put(peer_request, TRACKER_COMM_SIZE, GET_PEERS_TIMEOUT);
-  } catch (const simgrid::TimeoutError&) {
+  } catch (const simgrid::TimeoutException&) {
     XBT_DEBUG("Timeout expired when requesting peers to tracker");
     delete peer_request;
     return false;
     XBT_DEBUG("Timeout expired when requesting peers to tracker");
     delete peer_request;
     return false;
@@ -97,7 +97,7 @@ bool Peer::getPeersFromTracker()
       if (id != peer_id)
         connected_peers.emplace(peer_id, Connection(peer_id));
     delete answer;
       if (id != peer_id)
         connected_peers.emplace(peer_id, Connection(peer_id));
     delete answer;
-  } catch (const simgrid::TimeoutError&) {
+  } catch (const simgrid::TimeoutException&) {
     XBT_DEBUG("Timeout expired when requesting peers to tracker");
     return false;
   }
     XBT_DEBUG("Timeout expired when requesting peers to tracker");
     return false;
   }
index e1d3c23..9ad0c03 100644 (file)
@@ -110,7 +110,7 @@ void Node::notifyAndQuit()
   XBT_DEBUG("Sending a 'PREDECESSOR_LEAVING' to my successor %d", fingers_[0]);
   try {
     simgrid::s4u::Mailbox::by_name(std::to_string(fingers_[0]))->put(pred_msg, 10, timeout);
   XBT_DEBUG("Sending a 'PREDECESSOR_LEAVING' to my successor %d", fingers_[0]);
   try {
     simgrid::s4u::Mailbox::by_name(std::to_string(fingers_[0]))->put(pred_msg, 10, timeout);
-  } catch (const simgrid::TimeoutError&) {
+  } catch (const simgrid::TimeoutException&) {
     XBT_DEBUG("Timeout expired when sending a 'PREDECESSOR_LEAVING' to my successor %d", fingers_[0]);
     delete pred_msg;
   }
     XBT_DEBUG("Timeout expired when sending a 'PREDECESSOR_LEAVING' to my successor %d", fingers_[0]);
     delete pred_msg;
   }
@@ -124,7 +124,7 @@ void Node::notifyAndQuit()
 
     try {
       simgrid::s4u::Mailbox::by_name(std::to_string(pred_id_))->put(succ_msg, 10, timeout);
 
     try {
       simgrid::s4u::Mailbox::by_name(std::to_string(pred_id_))->put(succ_msg, 10, timeout);
-    } catch (const simgrid::TimeoutError&) {
+    } catch (const simgrid::TimeoutException&) {
       XBT_DEBUG("Timeout expired when sending a 'SUCCESSOR_LEAVING' to my predecessor %d", pred_id_);
       delete succ_msg;
     }
       XBT_DEBUG("Timeout expired when sending a 'SUCCESSOR_LEAVING' to my predecessor %d", pred_id_);
       delete succ_msg;
     }
@@ -214,7 +214,7 @@ void Node::checkPredecessor()
   XBT_DEBUG("Sending a 'Predecessor Alive' request to my predecessor %d", pred_id_);
   try {
     mailbox->put(message, 10, timeout);
   XBT_DEBUG("Sending a 'Predecessor Alive' request to my predecessor %d", pred_id_);
   try {
     mailbox->put(message, 10, timeout);
-  } catch (const simgrid::TimeoutError&) {
+  } catch (const simgrid::TimeoutException&) {
     XBT_DEBUG("Failed to send the 'Predecessor Alive' request to %d", pred_id_);
     delete message;
     return;
     XBT_DEBUG("Failed to send the 'Predecessor Alive' request to %d", pred_id_);
     delete message;
     return;
@@ -229,7 +229,7 @@ void Node::checkPredecessor()
     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);
     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 (const simgrid::TimeoutError&) {
+  } catch (const simgrid::TimeoutException&) {
     XBT_DEBUG("Failed to receive the answer to my 'Predecessor Alive' request");
     pred_id_ = -1;
   }
     XBT_DEBUG("Failed to receive the answer to my 'Predecessor Alive' request");
     pred_id_ = -1;
   }
@@ -255,7 +255,7 @@ int Node::remoteGetPredecessor(int ask_to)
   XBT_DEBUG("Sending a 'Get Predecessor' request to %d", ask_to);
   try {
     mailbox->put(message, 10, timeout);
   XBT_DEBUG("Sending a 'Get Predecessor' request to %d", ask_to);
   try {
     mailbox->put(message, 10, timeout);
-  } catch (const simgrid::TimeoutError&) {
+  } catch (const simgrid::TimeoutException&) {
     XBT_DEBUG("Failed to send the 'Get Predecessor' request to %d", ask_to);
     delete message;
     return predecessor_id;
     XBT_DEBUG("Failed to send the 'Get Predecessor' request to %d", ask_to);
     delete message;
     return predecessor_id;
@@ -273,7 +273,7 @@ int Node::remoteGetPredecessor(int ask_to)
               answer->answer_id);
     predecessor_id = answer->answer_id;
     delete answer;
               answer->answer_id);
     predecessor_id = answer->answer_id;
     delete answer;
-  } catch (const simgrid::TimeoutError&) {
+  } catch (const simgrid::TimeoutException&) {
     XBT_DEBUG("Failed to receive the answer to my 'Get Predecessor' request");
     delete static_cast<ChordMessage*>(data);
   }
     XBT_DEBUG("Failed to receive the answer to my 'Get Predecessor' request");
     delete static_cast<ChordMessage*>(data);
   }
@@ -327,7 +327,7 @@ int Node::remoteFindSuccessor(int ask_to, int id)
   XBT_DEBUG("Sending a 'Find Successor' request to %d for id %d", ask_to, id);
   try {
     mailbox->put(message, 10, timeout);
   XBT_DEBUG("Sending a 'Find Successor' request to %d for id %d", ask_to, id);
   try {
     mailbox->put(message, 10, timeout);
-  } catch (const simgrid::TimeoutError&) {
+  } catch (const simgrid::TimeoutException&) {
     XBT_DEBUG("Failed to send the 'Find Successor' request to %d for id %d", ask_to, id_);
     delete message;
     return successor;
     XBT_DEBUG("Failed to send the 'Find Successor' request to %d for id %d", ask_to, id_);
     delete message;
     return successor;
@@ -343,7 +343,7 @@ int Node::remoteFindSuccessor(int ask_to, int id)
               answer->request_id, id_, answer->answer_id);
     successor = answer->answer_id;
     delete answer;
               answer->request_id, id_, answer->answer_id);
     successor = answer->answer_id;
     delete answer;
-  } catch (const simgrid::TimeoutError&) {
+  } catch (const simgrid::TimeoutException&) {
     XBT_DEBUG("Failed to receive the answer to my 'Find Successor' request");
     delete static_cast<ChordMessage*>(data);
   }
     XBT_DEBUG("Failed to receive the answer to my 'Find Successor' request");
     delete static_cast<ChordMessage*>(data);
   }
index 9759607..146753e 100644 (file)
@@ -55,7 +55,7 @@ static void runner()
     simgrid::s4u::this_actor::parallel_execute(hosts, computation_amounts, communication_amounts,
                                                10.0 /* timeout (in seconds)*/);
     xbt_die("Woops, this did not timeout as expected... Please report that bug.");
     simgrid::s4u::this_actor::parallel_execute(hosts, computation_amounts, communication_amounts,
                                                10.0 /* timeout (in seconds)*/);
     xbt_die("Woops, this did not timeout as expected... Please report that bug.");
-  } catch (const simgrid::TimeoutError&) {
+  } catch (const simgrid::TimeoutException&) {
     XBT_INFO("Caught the expected timeout exception.");
   }
 
     XBT_INFO("Caught the expected timeout exception.");
   }
 
index b8004c6..0c5bf2d 100644 (file)
@@ -41,7 +41,7 @@ static int master(int argc, char* argv[])
       XBT_INFO("Send a message to %s", mailbox->get_cname());
       mailbox->put(payload, comm_size, 10.0);
       XBT_INFO("Send to %s completed", mailbox->get_cname());
       XBT_INFO("Send a message to %s", mailbox->get_cname());
       mailbox->put(payload, comm_size, 10.0);
       XBT_INFO("Send to %s completed", mailbox->get_cname());
-    } catch (const simgrid::TimeoutError&) {
+    } catch (const simgrid::TimeoutException&) {
       delete payload;
       XBT_INFO("Mmh. Got timeouted while speaking to '%s'. Nevermind. Let's keep going!", mailbox->get_cname());
     } catch (const simgrid::NetworkFailureException&) {
       delete payload;
       XBT_INFO("Mmh. Got timeouted while speaking to '%s'. Nevermind. Let's keep going!", mailbox->get_cname());
     } catch (const simgrid::NetworkFailureException&) {
@@ -57,7 +57,7 @@ static int master(int argc, char* argv[])
     double* payload = new double(-1.0);
     try {
       mailbox->put(payload, 0, 1.0);
     double* payload = new double(-1.0);
     try {
       mailbox->put(payload, 0, 1.0);
-    } catch (const simgrid::TimeoutError&) {
+    } catch (const simgrid::TimeoutException&) {
       delete payload;
       XBT_INFO("Mmh. Got timeouted while speaking to '%s'. Nevermind. Let's keep going!", mailbox->get_cname());
     } catch (const simgrid::NetworkFailureException&) {
       delete payload;
       XBT_INFO("Mmh. Got timeouted while speaking to '%s'. Nevermind. Let's keep going!", mailbox->get_cname());
     } catch (const simgrid::NetworkFailureException&) {
index 200eb19..e0dc7b4 100644 (file)
@@ -93,14 +93,16 @@ private:
 };
 
 /** Exception raised when a timeout elapsed */
 };
 
 /** Exception raised when a timeout elapsed */
-class TimeoutError : public Exception {
+class TimeoutException : public Exception {
 public:
 public:
-  TimeoutError(simgrid::xbt::ThrowPoint&& throwpoint, std::string&& message)
+  TimeoutException(simgrid::xbt::ThrowPoint&& throwpoint, std::string&& message)
       : Exception(std::move(throwpoint), std::move(message))
   {
   }
 };
 
       : Exception(std::move(throwpoint), std::move(message))
   {
   }
 };
 
+XBT_ATTRIB_DEPRECATED_v327("Please use simgrid::TimeoutException") typedef TimeoutException TimeoutError;
+
 /** Exception raised when a host fails */
 class HostFailureException : public Exception {
 public:
 /** Exception raised when a host fails */
 class HostFailureException : public Exception {
 public:
index 9031e83..4020b9c 100644 (file)
@@ -617,12 +617,12 @@ void CommImpl::finish()
 
         case SIMIX_SRC_TIMEOUT:
           simcall->issuer->exception_ = std::make_exception_ptr(
 
         case SIMIX_SRC_TIMEOUT:
           simcall->issuer->exception_ = std::make_exception_ptr(
-              simgrid::TimeoutError(XBT_THROW_POINT, "Communication timeouted because of the sender"));
+              simgrid::TimeoutException(XBT_THROW_POINT, "Communication timeouted because of the sender"));
           break;
 
         case SIMIX_DST_TIMEOUT:
           simcall->issuer->exception_ = std::make_exception_ptr(
           break;
 
         case SIMIX_DST_TIMEOUT:
           simcall->issuer->exception_ = std::make_exception_ptr(
-              simgrid::TimeoutError(XBT_THROW_POINT, "Communication timeouted because of the receiver"));
+              simgrid::TimeoutException(XBT_THROW_POINT, "Communication timeouted because of the receiver"));
           break;
 
         case SIMIX_SRC_HOST_FAILURE:
           break;
 
         case SIMIX_SRC_HOST_FAILURE:
index 18c816b..b7ed243 100644 (file)
@@ -269,7 +269,7 @@ void ExecImpl::finish()
 
       case SIMIX_TIMEOUT:
         XBT_DEBUG("ExecImpl::finish(): execution timeouted");
 
       case SIMIX_TIMEOUT:
         XBT_DEBUG("ExecImpl::finish(): execution timeouted");
-        simcall->issuer->exception_ = std::make_exception_ptr(simgrid::TimeoutError(XBT_THROW_POINT, "Timeouted"));
+        simcall->issuer->exception_ = std::make_exception_ptr(simgrid::TimeoutException(XBT_THROW_POINT, "Timeouted"));
         break;
 
       default:
         break;
 
       default:
index fcd867c..1ecb43d 100644 (file)
@@ -28,7 +28,7 @@ bool Comm::test()
       /* I am the receiver */
       (*task_received)->set_not_used();
     }
       /* I am the receiver */
       (*task_received)->set_not_used();
     }
-  } catch (const simgrid::TimeoutError&) {
+  } catch (const simgrid::TimeoutException&) {
     status_  = MSG_TIMEOUT;
     finished = true;
   } catch (const simgrid::CancelException&) {
     status_  = MSG_TIMEOUT;
     finished = true;
   } catch (const simgrid::CancelException&) {
@@ -52,7 +52,7 @@ msg_error_t Comm::wait_for(double timeout)
     }
 
     /* FIXME: these functions are not traceable */
     }
 
     /* FIXME: these functions are not traceable */
-  } catch (const simgrid::TimeoutError&) {
+  } catch (const simgrid::TimeoutException&) {
     status_ = MSG_TIMEOUT;
   } catch (const simgrid::CancelException&) {
     status_ = MSG_TASK_CANCELED;
     status_ = MSG_TIMEOUT;
   } catch (const simgrid::CancelException&) {
     status_ = MSG_TASK_CANCELED;
@@ -100,7 +100,7 @@ int MSG_comm_testany(xbt_dynar_t comms)
   msg_error_t status = MSG_OK;
   try {
     finished_index = simcall_comm_testany(s_comms.data(), s_comms.size());
   msg_error_t status = MSG_OK;
   try {
     finished_index = simcall_comm_testany(s_comms.data(), s_comms.size());
-  } catch (const simgrid::TimeoutError& e) {
+  } catch (const simgrid::TimeoutException& e) {
     finished_index = e.value;
     status         = MSG_TIMEOUT;
   } catch (const simgrid::CancelException& e) {
     finished_index = e.value;
     status         = MSG_TIMEOUT;
   } catch (const simgrid::CancelException& e) {
@@ -177,7 +177,7 @@ int MSG_comm_waitany(xbt_dynar_t comms)
   msg_error_t status = MSG_OK;
   try {
     finished_index = simcall_comm_waitany(s_comms.data(), s_comms.size(), -1);
   msg_error_t status = MSG_OK;
   try {
     finished_index = simcall_comm_waitany(s_comms.data(), s_comms.size(), -1);
-  } catch (const simgrid::TimeoutError& e) {
+  } catch (const simgrid::TimeoutException& e) {
     finished_index = e.value;
     status         = MSG_TIMEOUT;
   } catch (const simgrid::CancelException& e) {
     finished_index = e.value;
     status         = MSG_TIMEOUT;
   } catch (const simgrid::CancelException& e) {
index 7284a20..bbff07e 100644 (file)
@@ -83,7 +83,7 @@ msg_error_t Task::execute()
     XBT_DEBUG("Execution task '%s' finished", get_cname());
   } catch (const HostFailureException&) {
     status = MSG_HOST_FAILURE;
     XBT_DEBUG("Execution task '%s' finished", get_cname());
   } catch (const HostFailureException&) {
     status = MSG_HOST_FAILURE;
-  } catch (const TimeoutError&) {
+  } catch (const TimeoutException&) {
     status = MSG_TIMEOUT;
   } catch (const CancelException&) {
     status = MSG_TASK_CANCELED;
     status = MSG_TIMEOUT;
   } catch (const CancelException&) {
     status = MSG_TASK_CANCELED;
@@ -133,7 +133,7 @@ msg_error_t Task::send(const std::string& alias, double timeout)
     s4u::CommPtr s4u_comm = send_async(alias, nullptr, false);
     comm                  = s4u_comm;
     comm->wait_for(timeout);
     s4u::CommPtr s4u_comm = send_async(alias, nullptr, false);
     comm                  = s4u_comm;
     comm->wait_for(timeout);
-  } catch (const simgrid::TimeoutError&) {
+  } catch (const simgrid::TimeoutException&) {
     ret = MSG_TIMEOUT;
   } catch (const simgrid::CancelException&) {
     ret = MSG_HOST_FAILURE;
     ret = MSG_TIMEOUT;
   } catch (const simgrid::CancelException&) {
     ret = MSG_HOST_FAILURE;
@@ -623,7 +623,7 @@ msg_error_t MSG_task_receive_ext_bounded(msg_task_t* task, const char* alias, do
     (*task)->set_not_used();
   } catch (const simgrid::HostFailureException&) {
     ret = MSG_HOST_FAILURE;
     (*task)->set_not_used();
   } catch (const simgrid::HostFailureException&) {
     ret = MSG_HOST_FAILURE;
-  } catch (const simgrid::TimeoutError&) {
+  } catch (const simgrid::TimeoutException&) {
     ret = MSG_TIMEOUT;
   } catch (const simgrid::CancelException&) {
     ret = MSG_TASK_CANCELED;
     ret = MSG_TIMEOUT;
   } catch (const simgrid::CancelException&) {
     ret = MSG_TASK_CANCELED;