Commit 948a67a5 authored by Bastien Nocera's avatar Bastien Nocera

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.
parent de796095
......@@ -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);
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment