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:
parent
2f27b8d5fa
commit
35776c5d29
@ -55,9 +55,13 @@ GSource * meta_kms_register_fd_in_impl (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) \
|
||||
g_assert (meta_kms_in_impl_task (kms))
|
||||
#define meta_assert_not_in_kms_impl(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 */
|
||||
|
@ -154,6 +154,7 @@ struct _MetaKms
|
||||
|
||||
MetaKmsImpl *impl;
|
||||
gboolean in_impl_task;
|
||||
gboolean waiting_for_impl_task;
|
||||
|
||||
GList *devices;
|
||||
|
||||
@ -322,7 +323,9 @@ meta_kms_run_impl_task_sync (MetaKms *kms,
|
||||
gboolean ret;
|
||||
|
||||
kms->in_impl_task = TRUE;
|
||||
kms->waiting_for_impl_task = TRUE;
|
||||
ret = func (kms->impl, user_data, error);
|
||||
kms->waiting_for_impl_task = FALSE;
|
||||
kms->in_impl_task = FALSE;
|
||||
|
||||
return ret;
|
||||
@ -440,6 +443,12 @@ meta_kms_in_impl_task (MetaKms *kms)
|
||||
return kms->in_impl_task;
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_kms_is_waiting_for_impl_task (MetaKms *kms)
|
||||
{
|
||||
return kms->waiting_for_impl_task;
|
||||
}
|
||||
|
||||
static void
|
||||
meta_kms_update_states_in_impl (MetaKms *kms)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user