make read-line interruptable on a primitive port

Closes PR 14800

Merge to v6.1.1
This commit is contained in:
Matthew Flatt 2014-10-27 07:00:30 -06:00
parent 5eca66acdf
commit f31c6563e4
2 changed files with 10 additions and 0 deletions

View File

@ -260,6 +260,14 @@
(err/rt-test (read-line (current-input-port) 8))
(err/rt-test (read-line (current-input-port) 'anyx))
(when (file-exists? "/dev/zero")
;; Make sure read-line is interruptable on a primitive port that
;; has no line ending:
(define t (thread (lambda () (call-with-input-file* "/dev/zero" read-line))))
(sleep 0.1)
(kill-thread t)
(test #t thread-dead? t))
(arity-test open-input-file 1 1)
(err/rt-test (open-input-file 8))
(err/rt-test (open-input-file "x" 8))

View File

@ -3261,6 +3261,8 @@ do_read_line (int as_bytes, const char *who, int argc, Scheme_Object *argv[])
}
buf[i++] = ch;
if (ch > 127) ascii = 0;
SCHEME_USE_FUEL(1);
}
if (as_bytes) {