aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Gavrilov <angavrilov@gmail.com>2008-07-12 16:09:28 +0400
committerPaul Mackerras <paulus@samba.org>2008-07-31 20:29:44 +1000
commite2f90ee45c8b2d13a6c6b8a9f4bc3dce05408c99 (patch)
treef27e97a370bbc2640e17c7dcda1590f4286e6014
parentc11ff120f359bd7bd79c425135f85e1dca5ae252 (diff)
downloadgit-e2f90ee45c8b2d13a6c6b8a9f4bc3dce05408c99.tar.gz
git-e2f90ee45c8b2d13a6c6b8a9f4bc3dce05408c99.tar.xz
gitk: Kill back-end processes on window close
When collecting commits for a rarely changed, or recently created file or directory, rev-list may work for a noticeable period of time without producing any output. Such processes don't receive SIGPIPE for a while after gitk is closed, thus becoming runaway CPU hogs. Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
-rwxr-xr-xgitk35
1 files changed, 25 insertions, 10 deletions
diff --git a/gitk b/gitk
index fddcb4581..29d79d63d 100755
--- a/gitk
+++ b/gitk
@@ -375,19 +375,33 @@ proc start_rev_list {view} {
return 1
}
+proc stop_instance {inst} {
+ global commfd leftover
+
+ set fd $commfd($inst)
+ catch {
+ set pid [pid $fd]
+ exec kill $pid
+ }
+ catch {close $fd}
+ nukefile $fd
+ unset commfd($inst)
+ unset leftover($inst)
+}
+
+proc stop_backends {} {
+ global commfd
+
+ foreach inst [array names commfd] {
+ stop_instance $inst
+ }
+}
+
proc stop_rev_list {view} {
- global commfd viewinstances leftover
+ global viewinstances
foreach inst $viewinstances($view) {
- set fd $commfd($inst)
- catch {
- set pid [pid $fd]
- exec kill $pid
- }
- catch {close $fd}
- nukefile $fd
- unset commfd($inst)
- unset leftover($inst)
+ stop_instance $inst
}
set viewinstances($view) {}
}
@@ -2103,6 +2117,7 @@ proc makewindow {} {
bind . <$M1B-minus> {incrfont -1}
bind . <$M1B-KP_Subtract> {incrfont -1}
wm protocol . WM_DELETE_WINDOW doquit
+ bind . <Destroy> {stop_backends}
bind . <Button-1> "click %W"
bind $fstring <Key-Return> {dofind 1 1}
bind $sha1entry <Key-Return> gotocommit