@@ -384,14 +384,14 @@ struct DependencyScan {
384
384
DyndepLoader dyndep_loader_;
385
385
};
386
386
387
- // Implements a less comarison for edges by priority, where highest
387
+ // Implements a less comparison for edges by priority, where highest
388
388
// priority is defined lexicographically first by largest critical
389
389
// time, then lowest ID.
390
390
//
391
391
// Including ID means that wherever the critical times are the same,
392
392
// the edges are executed in ascending ID order which was historically
393
393
// how all tasks were scheduled.
394
- struct EdgePriorityCompare {
394
+ struct EdgePriorityLess {
395
395
bool operator ()(const Edge* e1 , const Edge* e2 ) const {
396
396
const int64_t ct1 = e1 ->critical_time ();
397
397
const int64_t ct2 = e2 ->critical_time ();
@@ -402,11 +402,18 @@ struct EdgePriorityCompare {
402
402
}
403
403
};
404
404
405
+ // Reverse of EdgePriorityLess, e.g. to sort by highest priority first
406
+ struct EdgePriorityGreater {
407
+ bool operator ()(const Edge* e1 , const Edge* e2 ) const {
408
+ return EdgePriorityLess ()(e2 , e1 );
409
+ }
410
+ };
411
+
405
412
// A priority queue holding non-owning Edge pointers. top() will
406
413
// return the edge with the largest critical time, and lowest ID if
407
414
// more than one edge has the same critical time.
408
415
class EdgePriorityQueue :
409
- public std::priority_queue<Edge*, std::vector<Edge*>, EdgePriorityCompare >{
416
+ public std::priority_queue<Edge*, std::vector<Edge*>, EdgePriorityLess >{
410
417
public:
411
418
void clear () {
412
419
c.clear ();
0 commit comments