mirror of
https://github.com/brl/mutter.git
synced 2025-01-30 21:32:19 +00:00
thread: Push the thread-default main context
Makes g_main_context_get_thread_default() do the right thing. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2777>
This commit is contained in:
parent
59ba952661
commit
0d5d1745ce
@ -297,14 +297,16 @@ thread_impl_func (gpointer user_data)
|
|||||||
MetaContext *context = meta_backend_get_context (priv->backend);
|
MetaContext *context = meta_backend_get_context (priv->backend);
|
||||||
MetaThreadImpl *impl = priv->impl;
|
MetaThreadImpl *impl = priv->impl;
|
||||||
MetaThreadImplRunFlags run_flags = META_THREAD_IMPL_RUN_FLAG_NONE;
|
MetaThreadImplRunFlags run_flags = META_THREAD_IMPL_RUN_FLAG_NONE;
|
||||||
#ifdef HAVE_PROFILER
|
|
||||||
GMainContext *thread_context = meta_thread_impl_get_main_context (impl);
|
GMainContext *thread_context = meta_thread_impl_get_main_context (impl);
|
||||||
|
#ifdef HAVE_PROFILER
|
||||||
MetaProfiler *profiler = meta_context_get_profiler (context);
|
MetaProfiler *profiler = meta_context_get_profiler (context);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
g_mutex_lock (&priv->kernel.init_mutex);
|
g_mutex_lock (&priv->kernel.init_mutex);
|
||||||
g_mutex_unlock (&priv->kernel.init_mutex);
|
g_mutex_unlock (&priv->kernel.init_mutex);
|
||||||
|
|
||||||
|
g_main_context_push_thread_default (thread_context);
|
||||||
|
|
||||||
#ifdef HAVE_PROFILER
|
#ifdef HAVE_PROFILER
|
||||||
meta_profiler_register_thread (profiler, thread_context, priv->name);
|
meta_profiler_register_thread (profiler, thread_context, priv->name);
|
||||||
#endif
|
#endif
|
||||||
@ -331,6 +333,8 @@ thread_impl_func (gpointer user_data)
|
|||||||
meta_profiler_unregister_thread (profiler, thread_context);
|
meta_profiler_unregister_thread (profiler, thread_context);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
g_main_context_pop_thread_default (thread_context);
|
||||||
|
|
||||||
return GINT_TO_POINTER (TRUE);
|
return GINT_TO_POINTER (TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user