if you have a unresolved read and a write w that is mod ordered after whatever that read sees, then any writes that are mo past w should not send their future values back to the unresolved read. So we begin by looking for operations that happen after the unresolved read and if they are a write we have our w, and if they are a read then its reads_from is our w.
The case I missed was we don't want to consider the write that the read we want to send the value to is currently reading... It won't cause a mo problem because it will be gone if we send a future value back to that read.
{
std::vector<action_list_t> *thrd_lists = obj_thrd_map->get_safe_ptr(reader->get_location());
unsigned int i;
-
/* Iterate over all threads */
for (i = 0; i < thrd_lists->size(); i++) {
const ModelAction *write_after_read = NULL;
break;
else if (act->is_write())
write_after_read = act;
- else if (act->is_read()&&act->get_reads_from()!=NULL) {
+ else if (act->is_read()&&act->get_reads_from()!=NULL&&act!=reader) {
write_after_read = act->get_reads_from();
}
}
if (write_after_read && write_after_read!=writer && mo_graph->checkReachable(write_after_read, writer))
return false;
}
-
return true;
}