Changeset 61ae4b0 in mainline
- Timestamp:
- 2022-08-15T17:19:55Z (2 years ago)
- Branches:
- master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ab855cd
- Parents:
- 46b305a
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2022-08-15 17:04:19)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2022-08-15 17:19:55)
- Location:
- kernel/generic
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/cpu.h
r46b305a r61ae4b0 74 74 size_t missed_clock_ticks; 75 75 76 /** Can only be accessed when interrupts are disabled. */ 76 77 uint64_t current_clock_tick; 77 78 -
kernel/generic/src/time/timeout.c
r46b305a r61ae4b0 87 87 irq_spinlock_lock(&CPU->timeoutlock, true); 88 88 89 assert(!link_in_use(&timeout->link)); 90 89 91 timeout->cpu = CPU; 90 92 timeout->deadline = CPU->current_clock_tick + us2ticks(time); … … 92 94 timeout->arg = arg; 93 95 94 /* 95 * Insert timeout into the active timeouts list according to timeout->deadline. 96 */ 97 timeout_t *target = NULL; 98 link_t *cur, *prev; 99 prev = NULL; 100 for (cur = list_first(&CPU->timeout_active_list); 101 cur != NULL; cur = list_next(cur, &CPU->timeout_active_list)) { 102 target = list_get_instance(cur, timeout_t, link); 96 /* Insert timeout into the active timeouts list according to timeout->deadline. */ 103 97 104 if (timeout->deadline < target->deadline) 105 break; 98 link_t *last = list_last(&CPU->timeout_active_list); 99 if (last == NULL || timeout->deadline >= list_get_instance(last, timeout_t, link)->deadline) { 100 list_append(&timeout->link, &CPU->timeout_active_list); 101 } else { 102 for (link_t *cur = list_first(&CPU->timeout_active_list); cur != NULL; 103 cur = list_next(cur, &CPU->timeout_active_list)) { 106 104 107 prev = cur; 105 if (timeout->deadline < list_get_instance(cur, timeout_t, link)->deadline) { 106 list_insert_before(&timeout->link, cur); 107 break; 108 } 109 } 108 110 } 109 110 if (prev == NULL)111 list_prepend(&timeout->link, &CPU->timeout_active_list);112 else113 list_insert_after(&timeout->link, prev);114 111 115 112 irq_spinlock_unlock(&CPU->timeoutlock, true);
Note:
See TracChangeset
for help on using the changeset viewer.