The LIFOManager schedules nodes by returning the last one added to the scheduler. A node is executed and then its ready outputs are newly added to the scheduler, so the LIFOManager will return outputs to a node following that node's execution.
| 182 | // the scheduler, so the LIFOManager will return outputs to a node following |
| 183 | // that node's execution. |
| 184 | class LIFOManager : public ReadyNodeManager { |
| 185 | public: |
| 186 | LIFOManager() : ReadyNodeManager() {} |
| 187 | ~LIFOManager() override {} |
| 188 | void AddNode(const NodeDef* node) override { nodes_.push_back(node); } |
| 189 | const NodeDef* GetCurrNode() override; |
| 190 | void RemoveCurrNode() override; |
| 191 | bool Empty() const override { return nodes_.empty(); } |
| 192 | |
| 193 | private: |
| 194 | std::list<const NodeDef*> nodes_; |
| 195 | // Keep track of the current node being executed by saving its position. |
| 196 | // Necessary because nodes may be added to the end of the list while a node is |
| 197 | // executing, and we want to remove the correct node (the one that is |
| 198 | // executing) rather than the new ones being added. |
| 199 | std::list<const NodeDef*>::iterator curr_pos_ = nodes_.end(); |
| 200 | }; |
| 201 | |
| 202 | // Abstract class that maintains a heap/priority queue for scheduling ready |
| 203 | // nodes. Derived class needs to implement the Greater() function which returns |