(ecore_fds, rfds, wfds, efds, ecore_timeout);
}
+static GMainContext *
+_ecore_glib_get_tizen_context(void)
+{
+ static GMainContext *ctx;
+ static int initialized;
+ const char *env;
+
+ if (initialized)
+ return ctx;
+
+ env = getenv("TIZEN_GLIB_CONTEXT");
+ if (env)
+ ctx = (GMainContext *)strtoul(env, NULL, 10);
+
+ initialized = 1;
+ return ctx;
+}
+
static int
_ecore_glib_select(int ecore_fds,
fd_set *rfds,
GMainContext *ctx;
int ret;
- //TIZEN_ONLY(220322): Use thread default context
- /* If a process sets the thread default context using the g_main_context_push_thread_default(),
+ //TIZEN_ONLY(220331): Use tizen glib context
+ /* If a process sets the tizen glib context using the getenv(),
* this function uses thread default context instead of the global default context.
*/
- ctx = g_main_context_get_thread_default();
+ ctx = _ecore_glib_get_tizen_context();
if (!ctx)
ctx = g_main_context_default();
return 0;
}
+#ifdef USR_G_MAIN_LOOP
+//TIZEN_ONLY(220331): Use tizen glib context
+/* If a process sets the tizen glib context using the getenv(),
+ * this function uses the tizen glib context instead of the global default context.
+ */
+static GMainContext *
+_ecore_glib_get_tizen_context(void)
+{
+ const char *env;
+ GMainContext *ctx;
+
+ env = getenv("TIZEN_GLIB_CONTEXT");
+ if (env)
+ ctx = (GMainContext *)strtoul(env, NULL, 10);
+ else
+ ctx = NULL;
+
+ return ctx;
+}
+#endif
+
void
_ecore_main_loop_begin(Eo *obj, Efl_Loop_Data *pd)
{
#else
if (!pd->do_quit)
{
- //TIZEN_ONLY(220322): Use thread default context
- /* If a process sets the thread default context using the g_main_context_push_thread_default(),
- * this function uses thread default context instead of the global default context.
+ //TIZEN_ONLY(220331): Use tizen glib context
+ /* If a process sets the tizen glib context using the getenv(),
+ * this function uses the tizen glib context instead of the global default context.
*/
if (!ecore_main_loop) {
ecore_main_loop = g_main_loop_new(
- g_main_context_get_thread_default(), FALSE);
+ _ecore_glib_get_tizen_context(), FALSE);
}
g_main_loop_run(ecore_main_loop);
}
#else
if (!pd->do_quit)
{
- //TIZEN_ONLY(220322): Use thread default context
- /* If a process sets the thread default context using the g_main_context_push_thread_default(),
- * this function uses thread default context instead of the global default context.
+ //TIZEN_ONLY(220331): Use tizen glib context
+ /* If a process sets the tizen glib context using the getenv(),
+ * this function uses the tizen glib context instead of the global default context.
*/
if (!ecore_main_loop) {
ecore_main_loop = g_main_loop_new(
- g_main_context_get_thread_default(), 1);
+ _ecore_glib_get_tizen_context(), 1);
}
g_main_loop_run(ecore_main_loop);
}