[gnome-builder] task: add ide_task_had_error()
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] task: add ide_task_had_error()
- Date: Wed, 21 Mar 2018 09:30:42 +0000 (UTC)
commit f83923c15f83aabb51bda54caa5cea1fc7077b0f
Author: Christian Hergert <chergert redhat com>
Date: Wed Mar 21 02:28:37 2018 -0700
task: add ide_task_had_error()
This allows porting various code from gtask
src/libide/threading/ide-task.c | 16 ++++++++++++++++
src/libide/threading/ide-task.h | 2 ++
2 files changed, 18 insertions(+)
---
diff --git a/src/libide/threading/ide-task.c b/src/libide/threading/ide-task.c
index b9ce6ebc4..730414f32 100644
--- a/src/libide/threading/ide-task.c
+++ b/src/libide/threading/ide-task.c
@@ -1959,6 +1959,22 @@ ide_task_set_name (IdeTask *self,
g_mutex_unlock (&priv->mutex);
}
+gboolean
+ide_task_had_error (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->result != NULL && priv->result->type == IDE_TASK_RESULT_ERROR) ||
+ (priv->thread_result != NULL && priv->thread_result->type == IDE_TASK_RESULT_ERROR);
+ g_mutex_unlock (&priv->mutex);
+
+ return ret;
+}
+
static gpointer
ide_task_get_user_data (GAsyncResult *result)
{
diff --git a/src/libide/threading/ide-task.h b/src/libide/threading/ide-task.h
index b09ec7f9d..c46fa5fcf 100644
--- a/src/libide/threading/ide-task.h
+++ b/src/libide/threading/ide-task.h
@@ -76,6 +76,8 @@ gpointer ide_task_get_source_tag (IdeTask *self);
IDE_AVAILABLE_IN_3_28
gpointer ide_task_get_task_data (IdeTask *self);
IDE_AVAILABLE_IN_3_28
+gboolean ide_task_had_error (IdeTask *self);
+IDE_AVAILABLE_IN_3_28
gboolean ide_task_is_valid (gpointer self,
gpointer source_object);
IDE_AVAILABLE_IN_3_28
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]