stats.num_buggy_executions++;
else if (is_complete_execution())
stats.num_complete++;
- else
+ else if (scheduler->all_threads_sleeping())
stats.num_redundant++;
+ else
+ ASSERT(false);
}
/** @brief Print execution stats */
#endif
model_print("Execution %d:", stats.num_total);
- if (isfeasibleprefix())
+ if (isfeasibleprefix()) {
+ if (scheduler->all_threads_sleeping())
+ model_print(" SLEEP-SET REDUNDANT");
model_print("\n");
- else
+ } else
print_infeasibility(" INFEASIBLE");
print_list(action_trace);
model_print("\n");
return get_enabled(t) == THREAD_SLEEP_SET;
}
+/**
+ * @brief Check if execution is stuck with no enabled threads and some sleeping
+ * thread
+ * @return True if no threads are enabled an some thread is in the sleep set;
+ * false otherwise
+ */
+bool Scheduler::all_threads_sleeping() const
+{
+ bool sleeping = false;
+ for (int i = 0; i < enabled_len; i++)
+ if (enabled[i] == THREAD_ENABLED)
+ return false;
+ else if (enabled[i] == THREAD_SLEEP_SET)
+ sleeping = true;
+ return sleeping;
+}
+
enabled_type_t Scheduler::get_enabled(const Thread *t) const
{
int id = id_to_int(t->get_id());
bool is_enabled(const Thread *t) const;
bool is_enabled(thread_id_t tid) const;
bool is_sleep_set(const Thread *t) const;
+ bool all_threads_sleeping() const;
void set_scheduler_thread(thread_id_t tid);
SNAPSHOTALLOC