device: Always use an internal cancellable for tasks

This will allow libfprint to cancel operations internally in the future.

If the internal cancellation method is used, then the private
current_cancellation_reason variable must be set to the GError. This
error will be returned when set.
This commit is contained in:
Benjamin Berg
2021-04-21 20:08:48 +02:00
parent a2d950044d
commit 71e0c29f28
5 changed files with 103 additions and 34 deletions

View File

@@ -67,8 +67,11 @@ typedef struct
/* We always make sure that only one task is run at a time. */
FpiDeviceAction current_action;
GTask *current_task;
GError *current_cancellation_reason;
GAsyncReadyCallback current_user_cb;
GCancellable *current_cancellable;
gulong current_cancellable_id;
gulong current_task_cancellable_id;
GSource *current_idle_cancel_source;
GSource *current_task_idle_return_source;