Permalink
Browse files

Properly respect priority among multiple tubes.

  • Loading branch information...
1 parent f1d7aca commit 34279364e6155131ba72b977c6f75c8b27b1fff4 @kr committed Jan 17, 2009
Showing with 18 additions and 1 deletion.
  1. +1 −1 prot.c
  2. +9 −0 sh-tests/multi-tube.commands
  3. +8 −0 sh-tests/multi-tube.expected
View
2 prot.c
@@ -373,7 +373,7 @@ next_eligible_job()
t->name, t->waiting.used, t->ready.used);
if (t->waiting.used && t->ready.used) {
candidate = pq_peek(&t->ready);
- if (!j || candidate->id < j->id) j = candidate;
+ if (!j || job_pri_cmp(candidate, j) < 0) j = candidate;
}
dprintf("i = %zu, tubes.used = %zu\n", i, tubes.used);
}
@@ -0,0 +1,9 @@
+use abc
+put 999999 0 0 0
+
+use def
+put 99 0 0 0
+
+watch abc
+watch def
+reserve
@@ -0,0 +1,8 @@
+USING abc
+INSERTED 1
+USING def
+INSERTED 2
+WATCHING 2
+WATCHING 3
+RESERVED 2 0
+

0 comments on commit 3427936

Please sign in to comment.