67 if ( !
timer->running ) {
79 DBGC2 (
timer,
"Timer %p started at time %ld (expires at %ld)\n",
118 unsigned long old_timeout =
timer->timeout;
120 unsigned long runtime;
123 if ( !
timer->running )
127 runtime = ( now -
timer->start );
129 DBGC2 (
timer,
"Timer %p stopped at time %ld (ran for %ld)\n",
130 timer, now, runtime );
147 if (
timer->count ) {
151 timer->timeout += ( runtime >> 1 );
152 if (
timer->timeout != old_timeout ) {
153 DBGC (
timer,
"Timer %p timeout updated to %ld\n",
172 DBGC2 (
timer,
"Timer %p stopped at time %ld on expiry\n",
180 timer->timeout <<= 1;
181 if ( ( fail = (
timer->timeout >
max ) ) )
183 DBGC (
timer,
"Timer %p timeout backed off to %ld\n",
208 used = ( now -
timer->start );
209 if ( used >=
timer->timeout ) {
#define list_add(new, head)
Add a new entry to the head of a list.
static void retry_step(struct process *process __unused)
Single-step the retry timer list.
struct list_head list
List of active timers.
#define list_del(list)
Delete an entry from a list.
#define __unused
Declare a variable or data structure as unused.
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
#define list_for_each_entry(pos, head, member)
Iterate over entries in a list.
#define DEFAULT_MAX_TIMEOUT
Default maximum timeout value (in ticks)
#define ref_get(refcnt)
Get additional reference to object.
#define DEFAULT_MIN_TIMEOUT
Default minimum timeout value (in ticks)
static LIST_HEAD(timers)
List of running timers.
void retry_poll(void)
Poll the retry timer list.
void start_timer(struct retry_timer *timer)
Start timer.
void start_timer_fixed(struct retry_timer *timer, unsigned long timeout)
Start timer with a specified timeout.
void stop_timer(struct retry_timer *timer)
Stop timer.
static struct timer * timer
Current timer.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
unsigned long currticks(void)
Get current system time in ticks.
static void timer_expired(struct retry_timer *timer)
Handle expired timer.
PERMANENT_PROCESS(retry_process, retry_step)
Retry timer process.
#define ref_put(refcnt)
Drop reference to object.