[Ecls-list] Threading as default feature

James M. Lawrence llmjjmll at gmail.com
Wed Jun 12 05:16:56 UTC 2013


Threading in ECL still seems experimental because it fails some basic
stress tests. I tend to classify thread problems as rather bad because
the door is opened to corruption. Doesn't enabling it by default
communicate the wrong message?

Probably simplest stress test that currently fails is in the last
comment at http://sourceforge.net/p/ecls/bugs/192/

(defun test (message-count thread-count)
  (let ((to-workers (mp:make-semaphore))
        (from-workers (mp:make-semaphore)))
    (loop :repeat thread-count :do
       (mp:process-run-function
        "test"
        (lambda ()
          (loop
             (mp:wait-on-semaphore to-workers)
             (mp:signal-semaphore from-workers)))))
    (loop
       (loop :repeat message-count :do
          (mp:signal-semaphore to-workers))
       (loop :repeat message-count :do
          (mp:wait-on-semaphore from-workers))
       (assert (zerop (mp:semaphore-count to-workers)))
       (assert (zerop (mp:semaphore-count from-workers)))
       (format t ".")
       (finish-output))))

(defun run ()
  (test 10000 64))




More information about the ecl-devel mailing list