char: add a QEMU_CHAR_FEATURE_GCONTEXT flag
commit9ac3788b0be368e2826a8e9adadc1ada87d89273
authorMarc-André Lureau <marcandre.lureau@redhat.com>
Wed, 5 Dec 2018 20:37:33 +0000 (6 00:37 +0400)
committerMarkus Armbruster <armbru@redhat.com>
Wed, 12 Dec 2018 08:55:57 +0000 (12 09:55 +0100)
treea91ff23c71736ba9d91377b0a066ab6fa71364fc
parentef12a703b7d4894a851cbf3e94cca8fa25fc43f2
char: add a QEMU_CHAR_FEATURE_GCONTEXT flag

QEMU_CHAR_FEATURE_GCONTEXT declares the character device can switch
GMainContext.

Assert we don't switch context when the character device doesn't
provide this feature.  Character device users must not violate this
restriction.  In particular, user configurations that violate them
must be rejected.

Existing frontend that rely on context switching would now assert() if
the backend doesn't allow it (instead of silently producing undesired
events in the default context). Following patches improve the
situation by reporting an error earlier instead, on the frontend side.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20181205203737.9011-4-marcandre.lureau@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
chardev/char.c
include/chardev/char.h