4 * Copyright (c) 2013 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Ja-young Gu <jygu@samsung.com>
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
22 #include "util_common.h"
24 static GMainLoop *g_loop = NULL;
25 static GMainContext *g_ctx = NULL;
27 void util_init_loop ()
29 g_ctx = g_main_context_new ();
30 g_main_context_push_thread_default (g_ctx);
31 g_loop = g_main_loop_new (g_ctx, FALSE);
34 void util_free_loop ()
36 g_main_context_pop_thread_default (g_ctx);
37 g_main_loop_unref (g_loop);
38 g_main_context_unref (g_ctx);
45 void util_start_loop ()
47 g_main_loop_run (g_loop);
50 void util_stop_loop ()
52 g_main_loop_quit (g_loop);