]> git.ipfire.org Git - thirdparty/qemu.git/commit - qemu-char.c
qemu-char: really fix behavior on can_read = 0
authorPaolo Bonzini <pbonzini@redhat.com>
Mon, 8 Apr 2013 13:03:15 +0000 (15:03 +0200)
committerAnthony Liguori <aliguori@us.ibm.com>
Mon, 8 Apr 2013 15:38:41 +0000 (10:38 -0500)
commit1e885b25275fb6763eb947b1e53b2d6911b967a8
treeaaf5aace44cbabf2b71d4b7219bce47f622e6cf9
parentb9a7cfee1280cc70ba0db2eb528ea3e5a072c80e
qemu-char: really fix behavior on can_read = 0

I misread the glib manual, g_source_remove does not let you re-attach
the source later.  This behavior (called "blocking" the source in glib)
is present in glib's source code, but private and not available outside
glib; hence, we have to resort to re-creating the source every time.

In fact, g_source_remove and g_source_destroy are the same thing,
except g_source_destroy is O(1) while g_source_remove scans a potentially
very long list of GSources in the current main loop.  Ugh.  Better
use g_source_destroy explicitly, and leave "tags" to those dummies who
cannot track their pointers' lifetimes.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 1365426195-12596-1-git-send-email-pbonzini@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
qemu-char.c