Skip to content

Commit

Permalink
Properly respect priority among multiple tubes.
Browse files Browse the repository at this point in the history
  • Loading branch information
kr committed Jan 17, 2009
1 parent f1d7aca commit 3427936
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion prot.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
9 changes: 9 additions & 0 deletions sh-tests/multi-tube.commands
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
use abc
put 999999 0 0 0

use def
put 99 0 0 0

watch abc
watch def
reserve
8 changes: 8 additions & 0 deletions sh-tests/multi-tube.expected
Original file line number Diff line number Diff line change
@@ -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.