summaryrefslogtreecommitdiff
path: root/gitk-git/gitk
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-08-17 06:21:07 (GMT)
committerJunio C Hamano <gitster@pobox.com>2008-08-17 06:21:07 (GMT)
commita0d74d160f3d416be8f7fbfd18fee0eebf40d8e0 (patch)
tree98e55c6411411e530535d06b537b78648a0c1817 /gitk-git/gitk
parentc14c8ceb13b299892f286757e22e6af4f6cffab5 (diff)
parentdf75e86d7307c2fd16d8df1bcbe8d7ccfb7305ff (diff)
downloadgit-a0d74d160f3d416be8f7fbfd18fee0eebf40d8e0.zip
git-a0d74d160f3d416be8f7fbfd18fee0eebf40d8e0.tar.gz
git-a0d74d160f3d416be8f7fbfd18fee0eebf40d8e0.tar.bz2
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/gitk')
-rw-r--r--gitk-git/gitk14
1 files changed, 8 insertions, 6 deletions
diff --git a/gitk-git/gitk b/gitk-git/gitk
index d093a39..087c4ac 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