Commit 9f1ae272 authored by Christian Hergert's avatar Christian Hergert

task: remove ide_task_run_in_thread_sync()

This wasn't exactly able to handle all situations, so we removed
our use of it in Builder (which is better anyway). So now remove
this so we don't accidentally start relying on it in the future.
parent dea8b39a
Pipeline #6685 passed with stage
in 23 minutes and 28 seconds
...@@ -1411,29 +1411,6 @@ unlock: ...@@ -1411,29 +1411,6 @@ unlock:
ide_task_return_error (self, g_steal_pointer (&error)); ide_task_return_error (self, g_steal_pointer (&error));
} }
/**
* ide_task_run_in_thread_sync: (skip)
*/
void
ide_task_run_in_thread_sync (IdeTask *self,
IdeTaskThreadFunc thread_func)
{
IdeTaskPrivate *priv = ide_task_get_instance_private (self);
g_autoptr(GMainContext) main_context = NULL;
g_return_if_fail (IDE_IS_TASK (self));
g_return_if_fail (thread_func != NULL);
g_mutex_lock (&priv->mutex);
main_context = g_main_context_ref (priv->main_context);
g_mutex_unlock (&priv->mutex);
ide_task_run_in_thread (self, thread_func);
while (!ide_task_get_completed (self))
g_main_context_iteration (main_context, TRUE);
}
static IdeTaskResult * static IdeTaskResult *
ide_task_propagate_locked (IdeTask *self, ide_task_propagate_locked (IdeTask *self,
IdeTaskResultType expected_type, IdeTaskResultType expected_type,
......
...@@ -125,9 +125,6 @@ IDE_AVAILABLE_IN_3_28 ...@@ -125,9 +125,6 @@ IDE_AVAILABLE_IN_3_28
void ide_task_run_in_thread (IdeTask *self, void ide_task_run_in_thread (IdeTask *self,
IdeTaskThreadFunc thread_func); IdeTaskThreadFunc thread_func);
IDE_AVAILABLE_IN_3_28 IDE_AVAILABLE_IN_3_28
void ide_task_run_in_thread_sync (IdeTask *self,
IdeTaskThreadFunc thread_func);
IDE_AVAILABLE_IN_3_28
void ide_task_set_check_cancellable (IdeTask *self, void ide_task_set_check_cancellable (IdeTask *self,
gboolean check_cancellable); gboolean check_cancellable);
IDE_AVAILABLE_IN_3_28 IDE_AVAILABLE_IN_3_28
......
...@@ -672,31 +672,6 @@ test_ide_task_report_new_error (void) ...@@ -672,31 +672,6 @@ test_ide_task_report_new_error (void)
g_main_loop_run (main_loop); g_main_loop_run (main_loop);
} }
static void
test_ide_task_run_in_thread_sync_cb (IdeTask *task,
gpointer source_object,
gpointer task_data,
GCancellable *cancellable)
{
g_assert (IDE_IS_TASK (task));
g_assert_null (source_object);
g_assert_null (task_data);
g_assert_null (cancellable);
ide_task_return_int (task, 774);
}
static void
test_ide_task_run_in_thread_sync (void)
{
g_autoptr(IdeTask) task = ide_task_new (NULL, NULL, NULL, NULL);
g_autoptr(GError) error = NULL;
ide_task_run_in_thread_sync (task, test_ide_task_run_in_thread_sync_cb);
g_assert_cmpint (774, ==, ide_task_propagate_int (task, &error));
g_assert_no_error (error);
}
gint gint
main (gint argc, main (gint argc,
gchar *argv[]) gchar *argv[])
...@@ -729,7 +704,6 @@ main (gint argc, ...@@ -729,7 +704,6 @@ main (gint argc,
g_test_add_func ("/Ide/Task/check-cancellable", test_ide_task_check_cancellable); g_test_add_func ("/Ide/Task/check-cancellable", test_ide_task_check_cancellable);
g_test_add_func ("/Ide/Task/return-on-cancel", test_ide_task_return_on_cancel); g_test_add_func ("/Ide/Task/return-on-cancel", test_ide_task_return_on_cancel);
g_test_add_func ("/Ide/Task/report-new-error", test_ide_task_report_new_error); g_test_add_func ("/Ide/Task/report-new-error", test_ide_task_report_new_error);
g_test_add_func ("/Ide/Task/run-in-thread-sync", test_ide_task_run_in_thread_sync);
return g_test_run (); return g_test_run ();
} }
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