Skip to content

Instantly share code, notes, and snippets.

@thezerobit
Created July 13, 2013 19:07
Show Gist options
  • Save thezerobit/5991835 to your computer and use it in GitHub Desktop.
Save thezerobit/5991835 to your computer and use it in GitHub Desktop.
A simple example of setting up 10 green threads with infinite loops that wait and do work periodically using green-threads and cl-async.
(ql:quickload "cl-async")
(ql:quickload "green-threads")
(cl-cont:defun/cc my-delay (time)
(cl-cont:let/cc continuation
(as:delay continuation :time time)))
(as:start-event-loop
(lambda ()
(gt:with-green-thread
(dotimes (x 10)
(gt:with-green-thread
(loop
(my-delay 1.0)
(format t "Hello~%")))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment