From 9ab812e65ac3bdf679247f01611f21d1af8968b9 Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Wed, 12 Dec 2012 18:27:27 -0800 Subject: [PATCH] model: change guaranteed condition into ASSERT() 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 | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/model.cc b/model.cc index 90b2c2f..059a522 100644 --- 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); -- 2.34.1