diff options
author | Jonathan Herman <hermanjl@cs.unc.edu> | 2011-10-09 22:07:46 -0400 |
---|---|---|
committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2011-10-09 22:07:46 -0400 |
commit | ba42974ea389f7f69800ddb39c7072f5252cbf98 (patch) | |
tree | d6019bb43aeae579118260c354a5dcfed3d7df4c /litmus/event_group.c | |
parent | bc92369ba24f72b916384ed80d4381549c6537a7 (diff) |
Allow events to be cancelled when their list is processed
Diffstat (limited to 'litmus/event_group.c')
-rw-r--r-- | litmus/event_group.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/litmus/event_group.c b/litmus/event_group.c index 518ccb459137..365ec1ee3651 100644 --- a/litmus/event_group.c +++ b/litmus/event_group.c | |||
@@ -33,7 +33,7 @@ static enum hrtimer_restart on_timer(struct hrtimer *timer) | |||
33 | unsigned long num = 0; | 33 | unsigned long num = 0; |
34 | struct event_list *el; | 34 | struct event_list *el; |
35 | struct rt_event *e; | 35 | struct rt_event *e; |
36 | struct list_head *pos, *safe, events; | 36 | struct list_head *pos, safe, events; |
37 | 37 | ||
38 | el = container_of(timer, struct event_list, timer); | 38 | el = container_of(timer, struct event_list, timer); |
39 | 39 | ||
@@ -47,16 +47,18 @@ static enum hrtimer_restart on_timer(struct hrtimer *timer) | |||
47 | list_replace_init(&el->events, &events); | 47 | list_replace_init(&el->events, &events); |
48 | 48 | ||
49 | /* Fire events */ | 49 | /* Fire events */ |
50 | list_for_each_safe(pos, safe, &events) { | 50 | for (pos = events.next; prefetch(pos->next), pos != &events;) { |
51 | num++; | 51 | num++; |
52 | e = list_entry(pos, struct rt_event, events_node); | 52 | e = list_entry(pos, struct rt_event, events_node); |
53 | VTRACE("Dequeueing event 0x%p with prio %d from 0x%p\n", | 53 | VTRACE("Dequeueing event 0x%p with prio %d from 0x%p\n", |
54 | e, e->prio, el); | 54 | e, e->prio, el); |
55 | list_replace(pos, &safe); | ||
55 | list_del_init(pos); | 56 | list_del_init(pos); |
56 | e->function(e); | 57 | e->function(e); |
58 | pos = safe.next; | ||
57 | } | 59 | } |
58 | VTRACE("Exhausted %d events from list 0x%p\n", num, el); | 60 | VTRACE("Exhausted %d events from list 0x%p\n", num, el); |
59 | sched_trace_action(NULL, num); | 61 | /* sched_trace_action(NULL, num); */ |
60 | return HRTIMER_NORESTART; | 62 | return HRTIMER_NORESTART; |
61 | } | 63 | } |
62 | 64 | ||