Created
July 13, 2013 19:07
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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