From df69cbac6f5c1aea821d468b1439a5e170f87566 Mon Sep 17 00:00:00 2001 From: Miguel de Icaza Date: Thu, 10 Oct 2002 19:28:23 +0000 Subject: [PATCH] Avoid queing multiple updates svn path=/trunk/gtk-sharp/; revision=8138 --- ChangeLog | 4 ++++ gtk/ThreadNotify.cs | 15 +++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index b07253f66..d7de7ff43 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2002-10-10 Miguel de Icaza + + * gtk/ThreadNotify.cs: Avoid multiple notifications. + 2002-10-09 Miguel de Icaza * glue/adjustment.c (gtksharp_gtk_adjustment_get_page_size): Added diff --git a/gtk/ThreadNotify.cs b/gtk/ThreadNotify.cs index 3301829e6..afae2fdf7 100644 --- a/gtk/ThreadNotify.cs +++ b/gtk/ThreadNotify.cs @@ -68,12 +68,17 @@ namespace Gtk { byte s; unsafe { - read (pipes [0], &s, 1); + lock (this) { + read (pipes [0], &s, 1); + notified = false; + } } re (); } + bool notified = false; + /// /// Invoke this function from a thread to call the `ReadyEvent' /// delegate provided in the constructor on the Main Gtk thread @@ -82,7 +87,13 @@ namespace Gtk { { unsafe { byte s; - write (pipes [1], &s, 1); + + lock (this){ + if (notified) + return; + write (pipes [1], &s, 1); + notified = true; + } } } }