spacepaste

  1.  
  2. (defun start-counting (octets limit)
  3. (loop for thread-index from 0 to 7
  4. with n = (/ (expt 256 (1- octets)) 8)
  5. with lock = (threads:make-lock)
  6. for start from 0 by n
  7. for end from n by n
  8. do
  9. (format *standard-output* "~&Thread index: ~A~%" thread-index)
  10. (threads:make-thread (lambda ()
  11. (let ((index thread-index)
  12. (count (count-occ octets start (1- end) limit)))
  13. (print count)
  14. (threads:with-lock-held (lock)
  15. (setf (aref *count* index) count)))))))
  16.