/branches/rcu/kernel/generic/include/time/timeout.h |
---|
36,14 → 36,37 |
#define KERN_TIMEOUT_H_ |
#include <arch/types.h> |
#ifdef CONFIG_TIMEOUT_EXTAVL_TREE |
#include <adt/extavl.h> |
#endif |
#include <adt/list.h> |
#include <cpu.h> |
typedef void (* timeout_handler_t)(void *arg); |
#ifdef CONFIG_TIMEOUT_EXTAVL_TREE |
typedef struct { |
SPINLOCK_DECLARE(lock); |
/** |
* Extended AVL tree node structure holds information |
* about connections with other timeouts. |
*/ |
extavltree_node_t node; |
/** Function that will be called on timeout activation. */ |
timeout_handler_t handler; |
/** Argument to be passed to handler() function. */ |
void *arg; |
/** On which processor is this timeout registered. */ |
cpu_t *cpu; |
} timeout_t; |
#else |
typedef struct { |
SPINLOCK_DECLARE(lock); |
/** Link to the list of active timeouts on THE->cpu */ |
link_t link; |
/** Timeout will be activated in this amount of clock() ticks. */ |
56,6 → 79,8 |
cpu_t *cpu; |
} timeout_t; |
#endif |
#define us2ticks(us) ((uint64_t) (((uint32_t) (us) / (1000000 / HZ)))) |
extern void timeout_init(void); |
/branches/rcu/kernel/generic/include/cpu.h |
---|
1,5 → 1,5 |
/* |
* Copyright (c) 2001-2004 Jakub Jermar |
* Copyright (C) 2001-2004 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
40,7 → 40,11 |
#include <proc/scheduler.h> |
#include <arch/cpu.h> |
#include <arch/context.h> |
#ifdef CONFIG_TIMEOUT_EXTAVL_TREE |
#include <adt/extavl.h> |
#endif |
#define CPU_STACK_SIZE STACK_SIZE |
/** CPU structure. |
47,7 → 51,7 |
* |
* There is one structure like this for every processor. |
*/ |
typedef struct { |
typedef struct cpu { |
SPINLOCK_DECLARE(lock); |
tlb_shootdown_msg_t tlb_messages[TLB_MESSAGE_QUEUE_LEN]; |
60,7 → 64,13 |
volatile count_t needs_relink; |
SPINLOCK_DECLARE(timeoutlock); |
#ifdef CONFIG_TIMEOUT_EXTAVL_TREE |
/** Extended AVL tree structure. */ |
extavltree_t timeout_active_tree; |
#else |
/** Head of list of timeouts. */ |
link_t timeout_active_head; |
#endif |
count_t missed_clock_ticks; /**< When system clock loses a tick, it is recorded here |
so that clock() can react. This variable is |