55,8 → 55,12 |
{ |
spinlock_initialize(&CPU->timeoutlock, "timeout_lock"); |
|
#ifdef CONFIG_TIMEOUT_EXTAVL_TREE |
#if defined CONFIG_TIMEOUT_AVL_TREE |
avltree_create(&CPU->timeout_active_tree); |
#elif defined CONFIG_TIMEOUT_EXTAVL_TREE |
extavltree_create(&CPU->timeout_active_tree); |
#elif defined CONFIG_TIMEOUT_EXTAVL_TREE |
extavlreltree_create(&CPU->timeout_active_tree); |
#else |
list_initialize(&CPU->timeout_active_head); |
#endif |
75,9 → 79,13 |
t->cpu = NULL; |
t->handler = NULL; |
t->arg = NULL; |
|
#ifdef CONFIG_TIMEOUT_EXTAVL_TREE |
|
#if defined CONFIG_TIMEOUT_AVL_TREE |
avltree_node_initialize(&t->node); |
#elif defined CONFIG_TIMEOUT_EXTAVL_TREE |
extavltree_node_initialize(&t->node); |
#elif defined CONFIG_TIMEOUT_EXTAVLREL_TREE |
extavlreltree_node_initialize(&t->node); |
#else |
t->ticks = 0; |
link_initialize(&t->link); |
98,11 → 106,14 |
timeout_reinitialize(t); |
} |
|
#ifdef CONFIG_TIMEOUT_EXTAVL_TREE |
#if defined CONFIG_TIMEOUT_AVL_TREE || \ |
defined CONFIG_TIMEOUT_EXTAVL_TREE || \ |
defined CONFIG_TIMEOUT_EXTAVLREL_TREE |
|
/** Register timeout |
* |
* Insert timeout handler f (with argument arg) |
* to timeout list and make it execute in |
* to timeout ExtAVL tree and make it execute in |
* time microseconds (or slightly more). |
* |
* @param t Timeout structure. |
124,14 → 135,21 |
panic("t->cpu != 0"); |
|
t->cpu = CPU; |
|
//tiky nejsou, musim zmenit klice primo v uzlech |
|
t->handler = f; |
t->arg = arg; |
t->node.key = us2ticks(time); |
|
/* |
* Put timeout into tree structure. |
*/ |
#if defined CONFIG_TIMEOUT_AVL_TREE |
avltree_insert(&CPU->timeout_active_tree,&t->node); |
#elif defined CONFIG_TIMEOUT_EXTAVL_TREE |
extavltree_insert(&CPU->timeout_active_tree,&t->node); |
|
#elif defined CONFIG_TIMEOUT_EXTAVLREL_TREE |
extavlreltree_insert(&CPU->timeout_active_tree,&t->node); |
#endif |
|
spinlock_unlock(&t->lock); |
spinlock_unlock(&CPU->timeoutlock); |
interrupts_restore(ipl); |
140,7 → 158,7 |
|
/** Unregister timeout |
* |
* Remove timeout from timeout list. |
* Remove timeout from timeout ExtAVL tree structure. |
* |
* @param t Timeout to unregister. |
* |
163,14 → 181,22 |
interrupts_restore(ipl); |
goto grab_locks; |
} |
|
/* |
* Now we know for sure that t hasn't been activated yet |
* and is lurking in t->cpu->timeout_active_head queue. |
*/ |
|
/* |
* Delete timeout from tree structure. |
*/ |
#if defined CONFIG_TIMEOUT_AVL_TREE |
avltree_delete(&CPU->timeout_active_tree,&t->node); |
#elif defined CONFIG_TIMEOUT_EXTAVL_TREE |
extavltree_delete(&CPU->timeout_active_tree,&t->node); |
|
#elif defined CONFIG_TIMEOUT_EXTAVLREL_TREE |
extavlreltree_delete(&CPU->timeout_active_tree,&t->node); |
#endif |
|
spinlock_unlock(&t->cpu->timeoutlock); |
|
timeout_reinitialize(t); |