return false;
synced_thread[id] = true;
- unsigned int sync_size = synced_thread.size();
- int promise_tid = id_to_int(read->get_tid());
- for (unsigned int i = 1; i < model->get_num_threads(); i++) {
- if ((i >= sync_size || !synced_thread[i]) && ((int)i != promise_tid) && model->is_enabled(int_to_id(i))) {
- return false;
- }
- }
- return true;
+ return has_failed();
}
-bool Promise::check_promise() const
+/**
+ * Check if this promise has failed. A promise can fail when all threads which
+ * could possibly satisfy the promise have been eliminated.
+ *
+ * @return True, if this promise has failed; false otherwise
+ */
+bool Promise::has_failed() const
{
unsigned int sync_size = synced_thread.size();
+ int promise_tid = id_to_int(read->get_tid());
for (unsigned int i = 1; i < model->get_num_threads(); i++) {
- if ((i >= sync_size || !synced_thread[i]) && model->is_enabled(int_to_id(i))) {
+ if ((i >= sync_size || !synced_thread[i]) && ((int)i != promise_tid) && model->is_enabled(int_to_id(i))) {
return false;
}
}