lib: Add internal fpi_timeout_cancel_all_for_dev()
This will be used to disable all timeouts for a device that's about to be closed, and freed.
This commit is contained in:
parent
de79609550
commit
948a67a51f
2 changed files with 20 additions and 1 deletions
|
@ -327,7 +327,7 @@ int fpi_img_compare_print_data_to_gallery(struct fp_print_data *print,
|
|||
struct fp_img *fpi_im_resize(struct fp_img *img, unsigned int w_factor, unsigned int h_factor);
|
||||
|
||||
/* polling */
|
||||
|
||||
void fpi_timeout_cancel_all_for_dev(struct fp_dev *dev);
|
||||
void fpi_poll_init(void);
|
||||
void fpi_poll_exit(void);
|
||||
|
||||
|
|
|
@ -477,3 +477,22 @@ void fpi_poll_exit(void)
|
|||
libusb_set_pollfd_notifiers(fpi_usb_ctx, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
fpi_timeout_cancel_all_for_dev(struct fp_dev *dev)
|
||||
{
|
||||
GSList *l;
|
||||
|
||||
g_return_if_fail (dev != NULL);
|
||||
|
||||
l = active_timers;
|
||||
while (l) {
|
||||
struct fpi_timeout *timeout = l->data;
|
||||
GSList *current = l;
|
||||
|
||||
l = l->next;
|
||||
if (timeout->dev == dev) {
|
||||
g_free (timeout);
|
||||
active_timers = g_slist_delete_link (active_timers, current);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue