diff --git a/prot.c b/prot.c index 2e72f0d6..77d2f801 100644 --- a/prot.c +++ b/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); } diff --git a/sh-tests/multi-tube.commands b/sh-tests/multi-tube.commands new file mode 100644 index 00000000..4e4b35cd --- /dev/null +++ b/sh-tests/multi-tube.commands @@ -0,0 +1,9 @@ +use abc +put 999999 0 0 0 + +use def +put 99 0 0 0 + +watch abc +watch def +reserve diff --git a/sh-tests/multi-tube.expected b/sh-tests/multi-tube.expected new file mode 100644 index 00000000..fed7d079 --- /dev/null +++ b/sh-tests/multi-tube.expected @@ -0,0 +1,8 @@ +USING abc +INSERTED 1 +USING def +INSERTED 2 +WATCHING 2 +WATCHING 3 +RESERVED 2 0 +