[noctool-cvs] CVS source
imattsson
imattsson at common-lisp.net
Thu Feb 12 20:41:09 UTC 2009
Update of /project/noctool/cvsroot/source
In directory cl-net:/tmp/cvs-serv21098
Added Files:
fork-test.lisp
Log Message:
IM
Rough test scaffolding to diagnose "crossed streams" issue.
--- /project/noctool/cvsroot/source/fork-test.lisp 2009/02/12 20:41:09 NONE
+++ /project/noctool/cvsroot/source/fork-test.lisp 2009/02/12 20:41:09 1.1
(defun worker (id lines)
(let ((id-string (format nil "~4,'0d" id)))
(with-pty (pty (sb-ext:process-pty (sb-ext:run-program "/usr/bin/env" (list "true" id-string) :wait nil :pty t)))
(loop for line = (read-line pty nil nil)
for count from 0 below lines
while line
do (progn
(unless (string= line id-string)
(format t "Thread ~d, expected ~a, saw ~a~%" id id-string line))
(sleep (* 0.1 (random 10))))))))
(defun main (workers &optional (line-count 100))
(loop for n from 1 to workers
collect (sb-thread:make-thread #'(lambda () (worker n line-count)))))
More information about the noctool-cvs
mailing list