mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
sysprof-cat: use single finally to exit main loop
This commit is contained in:
@ -438,22 +438,20 @@ sysprof_cat_fiber (gpointer data)
|
|||||||
|
|
||||||
exit_code = EXIT_SUCCESS;
|
exit_code = EXIT_SUCCESS;
|
||||||
|
|
||||||
g_main_loop_quit (main_loop);
|
|
||||||
|
|
||||||
return dex_future_new_for_boolean (TRUE);
|
return dex_future_new_for_boolean (TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static DexFuture *
|
static DexFuture *
|
||||||
sysprof_cat_catch_error_cb (DexFuture *future,
|
sysprof_cat_finally_cb (DexFuture *future,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
g_autoptr(GError) error = NULL;
|
g_autoptr(GError) error = NULL;
|
||||||
|
|
||||||
dex_await (dex_ref (future), &error);
|
if (!dex_await (dex_ref (future), &error))
|
||||||
|
{
|
||||||
g_printerr ("Error: %s\n", error->message);
|
g_printerr ("Error: %s\n", error->message);
|
||||||
|
exit_code = EXIT_FAILURE;
|
||||||
exit_code = EXIT_FAILURE;
|
}
|
||||||
|
|
||||||
g_main_loop_quit (main_loop);
|
g_main_loop_quit (main_loop);
|
||||||
|
|
||||||
@ -490,12 +488,12 @@ main (int argc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
dex_future_disown (
|
dex_future_disown (
|
||||||
dex_future_catch (
|
dex_future_finally (
|
||||||
dex_scheduler_spawn (NULL, 0,
|
dex_scheduler_spawn (NULL, 0,
|
||||||
sysprof_cat_fiber,
|
sysprof_cat_fiber,
|
||||||
g_strdup (argv[1]),
|
g_strdup (argv[1]),
|
||||||
g_free),
|
g_free),
|
||||||
sysprof_cat_catch_error_cb,
|
sysprof_cat_finally_cb,
|
||||||
NULL, NULL));
|
NULL, NULL));
|
||||||
|
|
||||||
if (exit_code == -1)
|
if (exit_code == -1)
|
||||||
|
|||||||
Reference in New Issue
Block a user