kms: Add assert to check that the main thread is blocked on impl task
This is so that we can have code in impl tasks that pokes at the main context objects. https://gitlab.gnome.org/GNOME/mutter/merge_requests/743
This commit is contained in:
@ -55,9 +55,13 @@ GSource * meta_kms_register_fd_in_impl (MetaKms *kms,
|
|||||||
|
|
||||||
gboolean meta_kms_in_impl_task (MetaKms *kms);
|
gboolean meta_kms_in_impl_task (MetaKms *kms);
|
||||||
|
|
||||||
|
gboolean meta_kms_is_waiting_for_impl_task (MetaKms *kms);
|
||||||
|
|
||||||
#define meta_assert_in_kms_impl(kms) \
|
#define meta_assert_in_kms_impl(kms) \
|
||||||
g_assert (meta_kms_in_impl_task (kms))
|
g_assert (meta_kms_in_impl_task (kms))
|
||||||
#define meta_assert_not_in_kms_impl(kms) \
|
#define meta_assert_not_in_kms_impl(kms) \
|
||||||
g_assert (!meta_kms_in_impl_task (kms))
|
g_assert (!meta_kms_in_impl_task (kms))
|
||||||
|
#define meta_assert_is_waiting_for_kms_impl_task(kms) \
|
||||||
|
g_assert (meta_kms_is_waiting_for_impl_task (kms))
|
||||||
|
|
||||||
#endif /* META_KMS_PRIVATE_H */
|
#endif /* META_KMS_PRIVATE_H */
|
||||||
|
@ -154,6 +154,7 @@ struct _MetaKms
|
|||||||
|
|
||||||
MetaKmsImpl *impl;
|
MetaKmsImpl *impl;
|
||||||
gboolean in_impl_task;
|
gboolean in_impl_task;
|
||||||
|
gboolean waiting_for_impl_task;
|
||||||
|
|
||||||
GList *devices;
|
GList *devices;
|
||||||
|
|
||||||
@ -322,7 +323,9 @@ meta_kms_run_impl_task_sync (MetaKms *kms,
|
|||||||
gboolean ret;
|
gboolean ret;
|
||||||
|
|
||||||
kms->in_impl_task = TRUE;
|
kms->in_impl_task = TRUE;
|
||||||
|
kms->waiting_for_impl_task = TRUE;
|
||||||
ret = func (kms->impl, user_data, error);
|
ret = func (kms->impl, user_data, error);
|
||||||
|
kms->waiting_for_impl_task = FALSE;
|
||||||
kms->in_impl_task = FALSE;
|
kms->in_impl_task = FALSE;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
@ -440,6 +443,12 @@ meta_kms_in_impl_task (MetaKms *kms)
|
|||||||
return kms->in_impl_task;
|
return kms->in_impl_task;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
meta_kms_is_waiting_for_impl_task (MetaKms *kms)
|
||||||
|
{
|
||||||
|
return kms->waiting_for_impl_task;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_kms_update_states_in_impl (MetaKms *kms)
|
meta_kms_update_states_in_impl (MetaKms *kms)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user