summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordas <das>2006-08-21 01:09:23 (GMT)
committerdas <das>2006-08-21 01:09:23 (GMT)
commitcb0736935b972229c3e6e381063853ebe23e9c78 (patch)
tree1b928b326a1dbe654a73ff4042eccb1b2ebfb057
parent3cedc1794d6970f02a8187771944b5dc6f378146 (diff)
downloadtk-cb0736935b972229c3e6e381063853ebe23e9c78.zip
tk-cb0736935b972229c3e6e381063853ebe23e9c78.tar.gz
tk-cb0736935b972229c3e6e381063853ebe23e9c78.tar.bz2
* macosx/tkMacOSXCarbonEvents.c (CarbonTimerProc): avoid starving main
event loop: limit the number of tcl events processed per invocation. Fixes bug reported on tcl-mac by Kevan Hashemi.
-rw-r--r--ChangeLog6
-rw-r--r--macosx/tkMacOSXCarbonEvents.c12
2 files changed, 14 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 36211a1..0350110 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2006-08-21 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/tkMacOSXCarbonEvents.c (CarbonTimerProc): avoid starving main
+ event loop: limit the number of tcl events processed per invocation.
+ Fixes bug reported on tcl-mac by Kevan Hashemi.
+
2006-08-18 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
* tests/text.test (text-25.15): Added test suggested by Sam
diff --git a/macosx/tkMacOSXCarbonEvents.c b/macosx/tkMacOSXCarbonEvents.c
index fc81844..e1d963c 100644
--- a/macosx/tkMacOSXCarbonEvents.c
+++ b/macosx/tkMacOSXCarbonEvents.c
@@ -60,7 +60,7 @@
* software in accordance with the terms specified in this
* license.
*
- * RCS: @(#) $Id: tkMacOSXCarbonEvents.c,v 1.11 2006/04/11 10:22:34 das Exp $
+ * RCS: @(#) $Id: tkMacOSXCarbonEvents.c,v 1.12 2006/08/21 01:09:23 das Exp $
*/
#include "tkMacOSXInt.h"
@@ -379,11 +379,15 @@ CarbonTimerProc (
EventLoopTimerRef timer,
void *userData)
{
- while(carbonTimerEnabled && Tcl_DoOneEvent(
- TCL_FILE_EVENTS|TCL_TIMER_EVENTS|TCL_DONT_WAIT)) {
+ if(carbonTimerEnabled) {
+ /* Avoid starving main event loop: process at most 4 events. */
+ int i = 4;
+ while(--i && Tcl_DoOneEvent(
+ TCL_FILE_EVENTS|TCL_TIMER_EVENTS|TCL_DONT_WAIT)) {
#if defined(TK_MAC_DEBUG) && defined(TK_MAC_DEBUG_CARBON_EVENTS)
- fprintf(stderr, "Processed tcl event from carbon timer\n");
+ fprintf(stderr, "Processed tcl event from carbon timer\n");
#endif /* TK_MAC_DEBUG_CARBON_EVENTS */
+ }
}
}