Changeset 583c2a3 in mainline for kernel/generic/src/time/timeout.c
- Timestamp:
- 2020-07-06T22:58:19Z (4 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 37d4c91, ee2f0beb
- Parents:
- 762f989
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/time/timeout.c
r762f989 r583c2a3 118 118 uint64_t sum = 0; 119 119 timeout_t *target = NULL; 120 link_t *cur; 121 for (cur = CPU->timeout_active_list.head.next; 122 cur != &CPU->timeout_active_list.head; cur = cur->next) { 120 link_t *cur, *prev; 121 prev = NULL; 122 for (cur = list_first(&CPU->timeout_active_list); 123 cur != NULL; cur = list_next(cur, &CPU->timeout_active_list)) { 123 124 target = list_get_instance(cur, timeout_t, link); 124 125 irq_spinlock_lock(&target->lock, false); … … 131 132 sum += target->ticks; 132 133 irq_spinlock_unlock(&target->lock, false); 133 } 134 135 /* Avoid using cur->prev directly */ 136 link_t *prev = cur->prev; 137 list_insert_after(&timeout->link, prev); 134 prev = cur; 135 } 136 137 if (prev == NULL) 138 list_prepend(&timeout->link, &CPU->timeout_active_list); 139 else 140 list_insert_after(&timeout->link, prev); 138 141 139 142 /* … … 146 149 * Decrease ticks of timeout's immediate succesor by timeout->ticks. 147 150 */ 148 if (cur != &CPU->timeout_active_list.head) {151 if (cur != NULL) { 149 152 irq_spinlock_lock(&target->lock, false); 150 153 target->ticks -= timeout->ticks; … … 187 190 */ 188 191 189 link_t *cur = timeout->link.next; 190 if (cur != &timeout->cpu->timeout_active_list.head) { 192 link_t *cur = list_next(&timeout->link, 193 &timeout->cpu->timeout_active_list); 194 if (cur != NULL) { 191 195 timeout_t *tmp = list_get_instance(cur, timeout_t, link); 192 196 irq_spinlock_lock(&tmp->lock, false);
Note:
See TracChangeset
for help on using the changeset viewer.