12.07.2015 Views

INTRO (9) NetBSD Kernel Developer's Manual INTRO (9) NAME ...

INTRO (9) NetBSD Kernel Developer's Manual INTRO (9) NAME ...

INTRO (9) NetBSD Kernel Developer's Manual INTRO (9) NAME ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CALLOUT (9) <strong>NetBSD</strong> <strong>Kernel</strong> Developer’s <strong>Manual</strong> CALLOUT (9)<strong>NAME</strong>callout_init, callout_destroy, callout_reset, callout_schedule,callout_setfunc, callout_stop, callout_expired, callout_invoking, callout_ack—execute a function after a specified length of timeSYNOPSIS#include voidcallout_init(callout_t ∗c , u_int flags);voidcallout_destroy(callout_t ∗c);voidcallout_reset(callout_t ∗c , int ticks , void (∗func)(void ∗) , void ∗arg);voidcallout_schedule(callout_t ∗c , int ticks);voidcallout_setfunc(callout_t ∗c , void (∗func)(void ∗) , void ∗arg);boolcallout_stop(callout_t ∗c);boolcallout_pending(callout_t ∗c);boolcallout_expired(callout_t ∗c);boolcallout_active(callout_t ∗c);boolcallout_invoking(callout_t ∗c);boolcallout_ack(callout_t ∗c);DESCRIPTIONThe callout facility provides a mechanism to execute a function at a given time. The timer is based on thehardclock timer which ticks hz times per second. The function is called at softclock interrupt level.Clients of the callout facility are responsible for providing pre-allocated callout structures, or “handles”.The callout facility replaces the historic UNIX functions timeout() and untimeout().The callout_init() function initializes the callout handle c for use. No operations can be performed onthe callout before it is initialized. If the flags argument is CALLOUT_MPSAFE, the handler will be calledwithout getting the global kernel lock. In this case it should only use functions that are multiprocessor safe.callout_destroy() destroys the callout, preventing further use. It is provided as a diagnostic facilityintended to catch bugs. To ensure future compatibility, callout_destroy() should always be calledwhen the callout is no longer required (for instance, when a device is being detached).The callout_reset() function resets and starts the timer associated with the callout handle c. When thetimer expires after ticks/hz seconds, the function specified by func will be called with the argument arg.If the timer associated with the callout handle is already running, the callout will simply be rescheduled to<strong>NetBSD</strong> 3.0 December 29, 2007 1

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!