diff options
author | das <das> | 2006-08-21 01:09:32 (GMT) |
---|---|---|
committer | das <das> | 2006-08-21 01:09:32 (GMT) |
commit | 9fc67ae4ed781c5e2f2ae2bb678651e83ff7294e (patch) | |
tree | 4f0e3c32595604e065d4aed8477c24fabfcacf83 | |
parent | dc316587c0b9053c09dfb532523bcdfd73169adc (diff) | |
download | tk-9fc67ae4ed781c5e2f2ae2bb678651e83ff7294e.zip tk-9fc67ae4ed781c5e2f2ae2bb678651e83ff7294e.tar.gz tk-9fc67ae4ed781c5e2f2ae2bb678651e83ff7294e.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-- | ChangeLog | 6 | ||||
-rw-r--r-- | macosx/tkMacOSXCarbonEvents.c | 12 |
2 files changed, 14 insertions, 4 deletions
@@ -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 Daniel Steffen <das@users.sourceforge.net> * unix/tcl.m4 (Darwin): add support for --enable-64bit on x86_64, for diff --git a/macosx/tkMacOSXCarbonEvents.c b/macosx/tkMacOSXCarbonEvents.c index d155725..76bfa8d 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.3.2.13 2006/04/28 06:02:58 das Exp $ + * RCS: @(#) $Id: tkMacOSXCarbonEvents.c,v 1.3.2.14 2006/08/21 01:09:32 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 */ + } } } |