Task

Using either native language concurrency syntax or freely available libraries, write a program to display the strings "Enjoy" "Rosetta" "Code", one string per line, in random order.

Concurrency syntax must use threads, tasks, co-routines, or whatever concurrency is called in your language.




(defun concurrency-example (&optional (out *standard-output*))
  (let ((lock (bordeaux-threads:make-lock)))
    (flet ((writer (string)
             #'(lambda () 
                 (bordeaux-threads:acquire-lock lock t)
                 (write-line string out)
                 (bordeaux-threads:release-lock lock))))
      (bordeaux-threads:make-thread (writer "Enjoy"))
      (bordeaux-threads:make-thread (writer "Rosetta"))
      (bordeaux-threads:make-thread (writer "Code")))))