Created
July 23, 2014 09:16
-
-
Save kedebug/eddfc8a9e981c6f67c8d to your computer and use it in GitHub Desktop.
select
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
(define chan-1 (make-chan)) | |
(define chan-2 (make-chan)) | |
(go (chan<- chan-1 'hello-chan-1)) | |
(go (chan<- chan-2 'hello-chan-2)) | |
; sleep for 20 millisecond | |
(sleep 20) | |
(select | |
((<-chan chan-1)) | |
((<-chan chan-2)) | |
(default 'hello-default)) | |
(close-chan chan-1) | |
(close-chan chan-2) | |
; the output will be randomized: hello-chan-1 or hello-chan-2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment