Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Replace some calls to THROWF.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Tue, 2 Jul 2019 13:47:05 +0000 (15:47 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Tue, 2 Jul 2019 14:12:21 +0000 (16:12 +0200)
src/kernel/activity/MutexImpl.cpp
src/surf/HostImpl.cpp
teshsuite/msg/app-bittorrent/bittorrent-peer.c

index 281cca4..25a0c77 100644 (file)
@@ -63,13 +63,9 @@ bool MutexImpl::try_lock(actor::ActorImpl* issuer)
 void MutexImpl::unlock(actor::ActorImpl* issuer)
 {
   XBT_IN("(%p, %p)", this, issuer);
-  if (not locked_)
-    THROWF(mismatch_error, 0, "Cannot release that mutex: it was not locked.");
-
-  /* If the mutex is not owned by the issuer, that's not good */
-  if (issuer != owner_)
-    THROWF(mismatch_error, 0, "Cannot release that mutex: it was locked by %s (pid:%ld), not by you.",
-           owner_->get_cname(), owner_->get_pid());
+  xbt_assert(locked_, "Cannot release that mutex: it was not locked.");
+  xbt_assert(issuer == owner_, "Cannot release that mutex: it was locked by %s (pid:%ld), not by you.",
+             owner_->get_cname(), owner_->get_pid());
 
   if (not sleeping_.empty()) {
     /*process to wake up */
index ff008ba..d38f868 100644 (file)
@@ -88,7 +88,7 @@ HostImpl::~HostImpl()
       msg += "\n\t" + std::string(process.get_name());
 
     SIMIX_display_process_status();
-    THROWF(arg_error, 0, "%s", msg.c_str());
+    xbt_die("%s", msg.c_str());
   }
   for (auto const& arg : actors_at_boot_)
     delete arg;
index afb6936..308a7b8 100644 (file)
@@ -626,9 +626,8 @@ void update_choked_peers(peer_t peer)
           i++;
         }
         xbt_dict_cursor_free(&cursor);
-        if (peer_choosed == NULL)
-          THROWF(unknown_error, 0, "A peer should have be selected at this point");
-        else if ((peer_choosed->interested == 0) || (peer_choosed->choked_upload == 0))
+        xbt_assert(peer_choosed != NULL, "A peer should have been selected at this point");
+        if ((peer_choosed->interested == 0) || (peer_choosed->choked_upload == 0))
           peer_choosed = NULL;
         else
           XBT_DEBUG("Nothing to do, keep going");