return blocking_threads;
}
+bool ModelExecution::is_yieldblocked() const
+{
+ for (unsigned int i = 0; i < get_num_threads(); i++) {
+ thread_id_t tid = int_to_id(i);
+ Thread *t = get_thread(tid);
+ if (t->get_pending() && t->get_pending()->is_yield())
+ return true;
+ }
+ return false;
+}
+
/**
* Check if this is a complete execution. That is, have all thread completed
* execution (rather than exiting because sleep sets have forced a redundant
*/
bool ModelExecution::is_complete_execution() const
{
+ if (params->yieldblock && is_yieldblocked())
+ return false;
for (unsigned int i = 0; i < get_num_threads(); i++)
if (is_enabled(int_to_id(i)))
return false;
thread_blocking_check_promises(blocking, get_thread(curr));
return false;
}
+ } else if (params->yieldblock && curr->is_yield()) {
+ return false;
}
return true;
model_print("Execution %d:", get_execution_number());
if (isfeasibleprefix()) {
+ if (params->yieldblock && is_yieldblocked())
+ model_print(" YIELD BLOCKED");
if (scheduler->all_threads_sleeping())
model_print(" SLEEP-SET REDUNDANT");
model_print("\n");
bool is_feasible_prefix_ignore_relseq() const;
bool is_infeasible() const;
bool is_deadlocked() const;
+ bool is_yieldblocked() const;
bool too_many_steps() const;
ModelAction * get_next_backtrack();
params->maxfuturedelay = 6;
params->fairwindow = 0;
params->yieldon = false;
+ params->yieldblock = false;
params->sc_trace_analysis = false;
params->enabledcount = 1;
params->bound = 0;
" priority for execution. Default: %d\n"
"-y Turn on CHESS yield-based fairness support.\n"
" Default: %d\n"
+"-Y Prohibit an execution from running a yield.\n"
+" Default: %d\n"
"-e Enabled count. Default: %d\n"
"-b Upper length bound. Default: %d\n"
"-v Print verbose execution information.\n"
"-u Value for uninitialized reads. Default: %u\n"
"-c Use SC Trace Analysis.\n"
"-- Program arguments follow.\n\n",
-params->maxreads, params->maxfuturevalues, params->maxfuturedelay, params->expireslop, params->fairwindow, params->yieldon, params->enabledcount, params->bound, params->uninitvalue);
+params->maxreads, params->maxfuturevalues, params->maxfuturedelay, params->expireslop, params->fairwindow, params->yieldon, params->yieldblock, params->enabledcount, params->bound, params->uninitvalue);
exit(EXIT_SUCCESS);
}
static void parse_options(struct model_params *params, int argc, char **argv)
{
- const char *shortopts = "hycm:M:s:S:f:e:b:u:v";
+ const char *shortopts = "hyYcm:M:s:S:f:e:b:u:v";
int opt;
bool error = false;
while (!error && (opt = getopt(argc, argv, shortopts)) != -1) {
case 'y':
params->yieldon = true;
break;
+ case 'Y':
+ params->yieldblock = true;
+ break;
default: /* '?' */
error = true;
break;