- (defun start-counting (octets limit)
- (loop for thread-index from 0 to 7
- with n = (/ (expt 256 (1- octets)) 8)
- with lock = (threads:make-lock)
- for start from 0 by n
- for end from n by n
- do
- (format *standard-output* "~&Thread index: ~A~%" thread-index)
- (threads:make-thread (lambda ()
- (let ((index thread-index)
- (count (count-occ octets start (1- end) limit)))
- (print count)
- (threads:with-lock-held (lock)
- (setf (aref *count* index) count)))))))