summaryrefslogtreecommitdiffstats
path: root/base/message_pump_glib.h
diff options
context:
space:
mode:
authordeanm@chromium.org <deanm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-18 01:30:42 +0000
committerdeanm@chromium.org <deanm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-18 01:30:42 +0000
commitaa0f26699ba66418e3d8fd06ba086142d7012377 (patch)
treed0f750093383b3fce661457968dfd05d6116f698 /base/message_pump_glib.h
parent7e503425499371c6eb68946bbd4bf63e652aff3d (diff)
downloadchromium_src-aa0f26699ba66418e3d8fd06ba086142d7012377.zip
chromium_src-aa0f26699ba66418e3d8fd06ba086142d7012377.tar.gz
chromium_src-aa0f26699ba66418e3d8fd06ba086142d7012377.tar.bz2
Fix the glib pump getting wedged.
I had previously used g_main_context_wakeup which uses glib's internal wakeup pipe. However, this won't ensure that our Dispatch method is called, so I think the poll() was returning, but our events never realized this so we kept on blocking infinitely. We need to make sure our Dispatch() is run when there is a wakeup, which means we have to use our own wakeup pipe so we can handle the event. Review URL: http://codereview.chromium.org/11432 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5590 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/message_pump_glib.h')
-rw-r--r--base/message_pump_glib.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/base/message_pump_glib.h b/base/message_pump_glib.h
index d632095..19d2ecd 100644
--- a/base/message_pump_glib.h
+++ b/base/message_pump_glib.h
@@ -64,6 +64,14 @@ class MessagePumpForUI : public MessagePump {
// the message pump is destroyed.
GSource* work_source_;
+ // We use a wakeup pipe to make sure we'll get out of the glib polling phase
+ // when another thread has scheduled us to do some work. There is a glib
+ // mechanism g_main_context_wakeup, but this won't guarantee that our event's
+ // Dispatch() will be called.
+ int wakeup_pipe_read_;
+ int wakeup_pipe_write_;
+ GPollFD wakeup_gpollfd_;
+
DISALLOW_COPY_AND_ASSIGN(MessagePumpForUI);
};