| 169 | } |
| 170 | |
| 171 | void TreeNode::setStatus(NodeStatus new_status) |
| 172 | { |
| 173 | if(new_status == NodeStatus::IDLE) |
| 174 | { |
| 175 | throw RuntimeError("Node [", name(), |
| 176 | "]: you are not allowed to set manually the status to IDLE. " |
| 177 | "If you know what you are doing (?) use resetStatus() instead."); |
| 178 | } |
| 179 | |
| 180 | NodeStatus prev_status = NodeStatus::IDLE; |
| 181 | { |
| 182 | const std::unique_lock<std::mutex> UniqueLock(_p->state_mutex); |
| 183 | prev_status = _p->status; |
| 184 | _p->status = new_status; |
| 185 | } |
| 186 | if(prev_status != new_status) |
| 187 | { |
| 188 | _p->state_condition_variable.notify_all(); |
| 189 | _p->state_change_signal.notify(std::chrono::high_resolution_clock::now(), *this, |
| 190 | prev_status, new_status); |
| 191 | } |
| 192 | } |
| 193 | |
| 194 | TreeNode::PreScripts& TreeNode::preConditionsScripts() |
| 195 | { |