summaryrefslogtreecommitdiffstats
path: root/src/state.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/state.cc')
-rw-r--r--src/state.cc27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/state.cc b/src/state.cc
index e8e6dc3..b34b938 100644
--- a/src/state.cc
+++ b/src/state.cc
@@ -22,6 +22,33 @@
#include "metrics.h"
#include "util.h"
+
+void Pool::EdgeScheduled(const Edge& edge) {
+ if (depth_ != 0)
+ current_use_ += edge.weight();
+}
+
+void Pool::EdgeFinished(const Edge& edge) {
+ if (depth_ != 0)
+ current_use_ -= edge.weight();
+}
+
+void Pool::DelayEdge(Edge* edge) {
+ assert(depth_ != 0);
+ delayed_.push(edge);
+}
+
+void Pool::RetrieveReadyEdges(set<Edge*>* ready_queue) {
+ while(!delayed_.empty()) {
+ Edge* edge = delayed_.front();
+ if(current_use_ + edge->weight() > depth_)
+ break;
+ delayed_.pop();
+ ready_queue->insert(edge);
+ EdgeScheduled(*edge);
+ }
+}
+
Pool State::kDefaultPool("", 0);
const Rule State::kPhonyRule("phony");