* timeout -- * Execute a function after a specified length of time. * * untimeout -- * Cancel previous timeout function call. * * callout_handle_init -- * Initialize a handle so that using it with untimeout is benign. * * See AT&T BCI Driver Reference Manual for specification. This * implementation differs from that one in that although an * identification value is re
| 626 | * identify entries for untimeout. |
| 627 | */ |
| 628 | struct callout_handle |
| 629 | timeout(timeout_t *ftn, void *arg, int to_ticks) |
| 630 | { |
| 631 | struct callout_cpu *cc; |
| 632 | struct callout *new; |
| 633 | struct callout_handle handle; |
| 634 | |
| 635 | cc = CC_CPU(timeout_cpu); |
| 636 | CC_LOCK(cc); |
| 637 | /* Fill in the next free callout structure. */ |
| 638 | new = SLIST_FIRST(&cc->cc_callfree); |
| 639 | if (new == NULL) |
| 640 | /* XXX Attempt to malloc first */ |
| 641 | panic("timeout table full"); |
| 642 | SLIST_REMOVE_HEAD(&cc->cc_callfree, c_links.sle); |
| 643 | callout_reset(new, to_ticks, ftn, arg); |
| 644 | handle.callout = new; |
| 645 | CC_UNLOCK(cc); |
| 646 | |
| 647 | return (handle); |
| 648 | } |
| 649 | |
| 650 | void |
| 651 | untimeout(timeout_t *ftn, void *arg, struct callout_handle handle) |
no test coverage detected