model: change guaranteed condition into ASSERT()
authorBrian Norris <banorris@uci.edu>
Thu, 13 Dec 2012 02:27:27 +0000 (18:27 -0800)
committerBrian Norris <banorris@uci.edu>
Thu, 13 Dec 2012 03:36:06 +0000 (19:36 -0800)
This guaranteed condition should only be included as an ASSERT(). This
gives a bonus, that the code becomes a little easier to read.

model.cc

index 90b2c2fcd55d47a779c9dc23d133e663b394071f..059a5228590f260813a50b28707d542cc20da4a3 100644 (file)
--- a/model.cc
+++ b/model.cc
@@ -2705,17 +2705,13 @@ bool ModelChecker::take_step() {
 
        Thread *curr = priv->current_action ? get_thread(priv->current_action) : NULL;
        if (curr) {
-               if (curr->get_state() == THREAD_READY) {
-                       ASSERT(priv->current_action);
+               ASSERT(curr->get_state() == THREAD_READY);
 
-                       priv->nextThread = check_current_action(priv->current_action);
-                       priv->current_action = NULL;
+               priv->nextThread = check_current_action(priv->current_action);
+               priv->current_action = NULL;
 
-                       if (curr->is_blocked() || curr->is_complete())
-                               scheduler->remove_thread(curr);
-               } else {
-                       ASSERT(false);
-               }
+               if (curr->is_blocked() || curr->is_complete())
+                       scheduler->remove_thread(curr);
        }
        Thread *next = scheduler->next_thread(priv->nextThread);