summaryrefslogtreecommitdiff
path: root/gitk-git
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2008-08-16 23:21:07 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2008-08-16 23:21:07 -0700
commita0d74d160f3d416be8f7fbfd18fee0eebf40d8e0 (patch)
tree98e55c6411411e530535d06b537b78648a0c1817 /gitk-git
parentGit.pm: Make File::Spec and File::Temp requirement lazy (diff)
parentgitk: Allow safely calling nukefile from a run queue handler (diff)
downloadtgif-a0d74d160f3d416be8f7fbfd18fee0eebf40d8e0.tar.xz
Merge git://git.kernel.org/pub/scm/gitk/gitk
* git://git.kernel.org/pub/scm/gitk/gitk: gitk: Allow safely calling nukefile from a run queue handler
Diffstat (limited to 'gitk-git')
-rw-r--r--gitk-git/gitk14
1 files changed, 8 insertions, 6 deletions
diff --git a/gitk-git/gitk b/gitk-git/gitk
index d093a39506..087c4ac733 100644
--- a/gitk-git/gitk
+++ b/gitk-git/gitk
@@ -22,11 +22,11 @@ proc gitdir {} {
# run before X event handlers, so reading from a fast source can
# make the GUI completely unresponsive.
proc run args {
- global isonrunq runq
+ global isonrunq runq currunq
set script $args
if {[info exists isonrunq($script)]} return
- if {$runq eq {}} {
+ if {$runq eq {} && ![info exists currunq]} {
after idle dorunq
}
lappend runq [list {} $script]
@@ -38,10 +38,10 @@ proc filerun {fd script} {
}
proc filereadable {fd script} {
- global runq
+ global runq currunq
fileevent $fd readable {}
- if {$runq eq {}} {
+ if {$runq eq {} && ![info exists currunq]} {
after idle dorunq
}
lappend runq [list $fd $script]
@@ -60,17 +60,19 @@ proc nukefile {fd} {
}
proc dorunq {} {
- global isonrunq runq
+ global isonrunq runq currunq
set tstart [clock clicks -milliseconds]
set t0 $tstart
while {[llength $runq] > 0} {
set fd [lindex $runq 0 0]
set script [lindex $runq 0 1]
+ set currunq [lindex $runq 0]
+ set runq [lrange $runq 1 end]
set repeat [eval $script]
+ unset currunq
set t1 [clock clicks -milliseconds]
set t [expr {$t1 - $t0}]
- set runq [lrange $runq 1 end]
if {$repeat ne {} && $repeat} {
if {$fd eq {} || $repeat == 2} {
# script returns 1 if it wants to be readded