summary refs log tree commit diff
diff options
context:
space:
mode:
authorBarton E. Schaefer <schaefer@zsh.org>2017-06-19 16:14:32 -0700
committerBarton E. Schaefer <schaefer@zsh.org>2017-06-19 16:14:32 -0700
commit9de905b22f7c9c57eef7021ea7737339e5d6d58e (patch)
treef287c7992872f194c46aa4ceee155992a984b334
parenta5ed661f256b424a2db60b9dbacadc94fe78d843 (diff)
downloadzsh-9de905b22f7c9c57eef7021ea7737339e5d6d58e.tar.gz
zsh-9de905b22f7c9c57eef7021ea7737339e5d6d58e.tar.xz
zsh-9de905b22f7c9c57eef7021ea7737339e5d6d58e.zip
41322: reduce number of changes in signal queuing/blocking state during shingetline() to improve read speed
-rw-r--r--ChangeLog3
-rw-r--r--Src/input.c8
2 files changed, 8 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index bff13b443..f79208403 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2017-06-19  Barton E. Schaefer  <schaefer@zsh.org>
 
+	* 41322 + comment: Src/input.c: reduce number of changes in signal
+	queuing/blocking state during shingetline() to improve read speed
+
 	* 41317: Src/exec.c: use heap allocation in getoutputfile() to
 	plug memory leak
 
diff --git a/Src/input.c b/Src/input.c
index 92abaec92..9787dedf6 100644
--- a/Src/input.c
+++ b/Src/input.c
@@ -144,9 +144,10 @@ shingetline(void)
     int q = queue_signal_level();
 
     p = buf;
+    winch_unblock();
+    dont_queue_signals();
     for (;;) {
-	winch_unblock();
-	dont_queue_signals();
+	/* Can't fgets() here because we need to accept '\0' bytes */
 	do {
 	    errno = 0;
 	    c = fgetc(bshin);
@@ -176,7 +177,8 @@ shingetline(void)
 	    ll += p - buf;
 	    line[ll] = '\0';
 	    p = buf;
-	    unqueue_signals();
+	    winch_unblock();
+	    dont_queue_signals();
 	}
     }
 }