Permalink
Browse files

re-reverting 21d2b38, with comments. Appears to be a real race.

  • Loading branch information...
evaleev committed Nov 16, 2017
1 parent 81a50f1 commit 5e4aa804772551b9a79216435e5e922bc5052fa3
Showing with 15 additions and 7 deletions.
  1. +15 −7 src/madness/world/world_task_queue.h
@@ -450,13 +450,21 @@ namespace madness {
t->set_info(&world, this); // Stuff info
if (t->ndep() == 0) {
ThreadPool::add(t); // If no dependencies directly submit
} else {
// With dependencies must use the callback to avoid race condition
t->register_submit_callback();
//t->dec();
}
// EFV the original code below has a race (perhaps the race was introduced by the changes in how DependencyInterface operates)
// consider a task that creates its prerequisites in a ctor, hence it has not been added to the queue yet.
// if the last prerequisite *just* updated t's ndepend to 0 (via DependencyInterface::dec()) this will submit t immediately. If this task
// gets executed and destroyed before prerequisite's call to DependencyInterface::dec() completes (note that callback move can
// take a few tics, or we are oversubscribed) we have a race.
//
//if (t->ndep() == 0) {
// ThreadPool::add(t); // If no dependencies directly submit
//} else {
// // With dependencies must use the callback to avoid race condition
// t->register_submit_callback();
// //t->dec();
//}
t->register_submit_callback();
}
/// \todo Brief description needed.

0 comments on commit 5e4aa80

Please sign in to comment.