Skip to content

Commit

Permalink
Decrements active task counter when reaction call is cancelled due to…
Browse files Browse the repository at this point in the history
… missing data (#19)
  • Loading branch information
Bidski authored and TrentHouliston committed Apr 14, 2018
1 parent a20a03a commit 1d77026
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/include/nuclear_bits/util/CallbackGenerator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@ namespace util {

// Add one to our active tasks
++r.active_tasks;

// Check if we should even run
if (!DSL::precondition(r)) {
// Take one from our active tasks
--r.active_tasks;

// We cancel our execution by returning an empty function
return std::make_pair(0, threading::ReactionTask::TaskFunction());
}
Expand All @@ -82,6 +82,9 @@ namespace util {

// Check if our data is good (all the data exists) otherwise terminate the call
if (!check_data(data)) {
// Take one from our active tasks
--r.active_tasks;

// We cancel our execution by returning an empty function
return std::make_pair(0, threading::ReactionTask::TaskFunction());
}
Expand Down Expand Up @@ -118,7 +121,7 @@ namespace util {

// Run our postconditions
DSL::postcondition(*task);

// Take one from our active tasks
--task->parent.active_tasks;

Expand Down

0 comments on commit 1d77026

Please sign in to comment.