[gnome-builder] task: add ide_task_get_return_on_cancel()
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] task: add ide_task_get_return_on_cancel()
- Date: Wed, 21 Mar 2018 07:57:19 +0000 (UTC)
commit cd6ae66a625f707952b31e34624ae5ca3596ebad
Author: Christian Hergert <chergert redhat com>
Date: Wed Mar 21 00:56:57 2018 -0700
task: add ide_task_get_return_on_cancel()
src/libide/threading/ide-task.c | 22 ++++++++++++++++++++++
src/libide/threading/ide-task.h | 2 ++
2 files changed, 24 insertions(+)
---
diff --git a/src/libide/threading/ide-task.c b/src/libide/threading/ide-task.c
index afd226acb..b9ce6ebc4 100644
--- a/src/libide/threading/ide-task.c
+++ b/src/libide/threading/ide-task.c
@@ -1790,6 +1790,28 @@ ide_task_cancellable_cancelled_cb (GCancellable *cancellable,
g_source_unref (source);
}
+/**
+ * ide_task_get_return_on_cancel:
+ * @self: a #IdeTask
+ *
+ * Gets the return_on_cancel value, which means the task will return
+ * immediately when the #GCancellable is cancelled.
+ */
+gboolean
+ide_task_get_return_on_cancel (IdeTask *self)
+{
+ IdeTaskPrivate *priv = ide_task_get_instance_private (self);
+ gboolean ret;
+
+ g_return_val_if_fail (IDE_IS_TASK (self), FALSE);
+
+ g_mutex_lock (&priv->mutex);
+ ret = priv->return_on_cancel;
+ g_mutex_unlock (&priv->mutex);
+
+ return ret;
+}
+
/**
* ide_task_set_return_on_cancel:
* @self: a #IdeTask
diff --git a/src/libide/threading/ide-task.h b/src/libide/threading/ide-task.h
index 1b8ece10a..b09ec7f9d 100644
--- a/src/libide/threading/ide-task.h
+++ b/src/libide/threading/ide-task.h
@@ -109,6 +109,8 @@ IDE_AVAILABLE_IN_3_28
void ide_task_return_int (IdeTask *self,
gssize result);
IDE_AVAILABLE_IN_3_28
+gboolean ide_task_get_return_on_cancel (IdeTask *self);
+IDE_AVAILABLE_IN_3_28
void ide_task_return_new_error (IdeTask *self,
GQuark error_domain,
gint error_code,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]