11 lines
482 B
Common Lisp
11 lines
482 B
Common Lisp
(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")))))
|