Top |
void | (*fpi_timeout_fn) () |
fpi_timeout * | fpi_timeout_add () |
void | fpi_timeout_set_name () |
void | fpi_timeout_cancel () |
Helper functions to schedule a function call to be made after a timeout. This is useful to avoid making blocking calls while waiting for hardware to answer for example.
void (*fpi_timeout_fn) (struct fp_dev *dev
,void *data
);
The prototype of the callback function for fpi_timeout_add()
.
Note that after the callback is called, the fpi_timeout structure will
be freed.
dev |
the struct fp_dev passed to |
|
data |
the data passed to |
fpi_timeout * fpi_timeout_add (unsigned int msec
,fpi_timeout_fn callback
,struct fp_dev *dev
,void *data
);
A timeout is the asynchronous equivalent of sleeping. You create a timeout saying that you'd like to have a function invoked at a certain time in the future.
Note that you should hold onto the return value of this function to cancel it
use fpi_timeout_cancel()
, otherwise the callback could be called while the driver
is being torn down.
This function can be considered to never fail.
msec |
the time before calling the function, in milliseconds (1/1000ths of a second) |
|
callback |
function to callback |
|
dev |
a struct fp_dev |
|
data |
data to pass to |
void fpi_timeout_set_name (fpi_timeout *timeout
,const char *name
);
Sets a name for a timeout, allowing that name to be printed along with any timeout related debug.
void
fpi_timeout_cancel (fpi_timeout *timeout
);
Cancels a timeout scheduled with fpi_timeout_add()
, and frees the
timeout
structure.
typedef struct fpi_timeout fpi_timeout;
An opaque structure representing a scheduled function call, created with
fpi_timeout_add()
.