diff options
author | Glenn Elliott <gelliott@cs.unc.edu> | 2013-04-01 18:58:46 -0400 |
---|---|---|
committer | Glenn Elliott <gelliott@cs.unc.edu> | 2013-04-01 18:58:46 -0400 |
commit | 3324865fc5792b9d755d46cafa42c74b5037bba5 (patch) | |
tree | 3093b97b7ece695d0bc64f7f92d8083f2fbf9c95 /litmus/bheap.c | |
parent | 699737644d64e88bceafb9c2d39bd587057c732a (diff) |
SOBLIV: Drain budget while task is in top-m only.
Also fixed numerous bugs...
Diffstat (limited to 'litmus/bheap.c')
-rw-r--r-- | litmus/bheap.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/litmus/bheap.c b/litmus/bheap.c index 45e1db36fa36..403c09cc9e81 100644 --- a/litmus/bheap.c +++ b/litmus/bheap.c | |||
@@ -21,6 +21,29 @@ void bheap_node_init(struct bheap_node** _h, void* value) | |||
21 | } | 21 | } |
22 | 22 | ||
23 | 23 | ||
24 | static void __bheap_for_all(struct bheap_node *h, bheap_for_all_t fn, void* args) | ||
25 | { | ||
26 | /* pre-order */ | ||
27 | fn(h, args); | ||
28 | |||
29 | /* depth-first */ | ||
30 | if (h->child) | ||
31 | __bheap_for_all(h->child, fn, args); | ||
32 | if (h->next) | ||
33 | __bheap_for_all(h->next, fn, args); | ||
34 | } | ||
35 | |||
36 | void bheap_for_all(struct bheap* heap, bheap_for_all_t fn, void* args) | ||
37 | { | ||
38 | struct bheap_node *head; | ||
39 | |||
40 | BUG_ON(!heap); | ||
41 | BUG_ON(!fn); | ||
42 | |||
43 | head = heap->head; | ||
44 | __bheap_for_all(head, fn, args); | ||
45 | } | ||
46 | |||
24 | /* make child a subtree of root */ | 47 | /* make child a subtree of root */ |
25 | static void __bheap_link(struct bheap_node* root, | 48 | static void __bheap_link(struct bheap_node* root, |
26 | struct bheap_node* child) | 49 | struct bheap_node* child) |