|
AquilaOS documentation
How it works, and its code
|
Callouts: functions to call at a time to come (see sys/callout.h). More...
Go to the source code of this file.
Functions | |
| void | callout_stop (struct callout *c) |
| Cancels a callout, if it is pending. | |
| void | callout_set_on (struct callout_list *list, struct callout *c, uint64_t ns, void(*fn)(void *), void *arg) |
| Sets a callout on a list: fn(arg) will be called once ns ns have passed, by whoever runs the list. | |
| void | callout_set (struct callout *c, uint64_t ns, void(*fn)(void *), void *arg) |
| Sets a callout on the timer's list: fn(arg) will be called from the timer interrupt once ns ns have passed. | |
| void | callout_list_run (struct callout_list *list, uint64_t now) |
| Calls the callouts of a list that are due, taking each off the list first. | |
| uint64_t | callout_list_next (struct callout_list *list) |
| Finds when the first callout of a list is due. | |
| void | callout_run (uint64_t now) |
| Calls the timer's callouts that are due, from the timer interrupt. | |
Variables | |
| static struct callout_list | timer_callouts |
Callouts: functions to call at a time to come (see sys/callout.h).
Each list of callouts is run from one place only. The timer's list is run by the timer interrupt (sched_timer_tick()), which checks it on every tick. Any other list is run by the thread that owns it, which sleeps until the first callout is due (callout_list_next()): TCP's timers run in the network's thread this way. The caller owns each struct callout, so setting one never allocates and never fails.
Definition in file callout.c.
| uint64_t callout_list_next | ( | struct callout_list * | list | ) |
Finds when the first callout of a list is due.
| list | the list |
Definition at line 115 of file callout.c.
References callout_list_next(), list::head, callout::next, and callout::when.
Referenced by callout_list_next(), and net_main().
| void callout_list_run | ( | struct callout_list * | list, |
| uint64_t | now ) |
Calls the callouts of a list that are due, taking each off the list first.
| list | the list |
| now | the time, in arch_rtime_ns() time |
Definition at line 86 of file callout.c.
References callout::arg, callout_list_run(), callout::fn, list::head, callout::list, callout::next, NULL, callout::pending, and callout::when.
Referenced by callout_list_run(), callout_run(), and net_main().
| void callout_run | ( | uint64_t | now | ) |
Calls the timer's callouts that are due, from the timer interrupt.
| now | the time, in arch_rtime_ns() time |
Definition at line 131 of file callout.c.
References callout_list_run(), callout_run(), and timer_callouts.
Referenced by callout_run(), and sched_timer_tick().
Sets a callout on the timer's list: fn(arg) will be called from the timer interrupt once ns ns have passed.
| c | the callout |
| ns | the delay, in ns |
| fn | the function to call |
| arg | its argument |
Definition at line 74 of file callout.c.
References callout_set(), callout_set_on(), and timer_callouts.
Referenced by callout_set().
| void callout_set_on | ( | struct callout_list * | list, |
| struct callout * | c, | ||
| uint64_t | ns, | ||
| void(* | fn )(void *), | ||
| void * | arg ) |
Sets a callout on a list: fn(arg) will be called once ns ns have passed, by whoever runs the list.
A callout that was pending is cancelled first.
| list | the list it goes on |
| c | the callout |
| ns | the delay, in ns |
| fn | the function to call |
| arg | its argument |
Definition at line 50 of file callout.c.
References arch_rtime_ns(), callout::arg, callout_set_on(), callout_stop(), callout::fn, list::head, callout::list, callout::next, callout::pending, and callout::when.
Referenced by callout_set(), callout_set_on(), and net_callout_set().
| void callout_stop | ( | struct callout * | c | ) |
Cancels a callout, if it is pending.
| c | the callout |
Definition at line 23 of file callout.c.
References callout_stop(), callout_list::head, callout::list, callout::next, NULL, and callout::pending.
Referenced by ack_input(), callout_set_on(), callout_stop(), pending_drop(), pending_flush(), segment(), segment_input(), syn_sent_input(), tcp_closed(), tcp_pcb_free(), and tcp_time_wait().
|
static |
Definition at line 16 of file callout.c.
Referenced by callout_run(), and callout_set().