Created
June 27, 2017 01:23
-
-
Save karahiyo/50e32bf5387ec1303c745a87469f1b23 to your computer and use it in GitHub Desktop.
gauche thread-pool test
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
#!/usr/bin/env gosh | |
(use control.thread-pool) | |
(define (log msg) | |
(print (sys-time) ": " msg)) | |
(log "start") | |
(define (run ls) | |
(let* ((pool (make-thread-pool 5))) | |
(begin | |
(map (^n (add-job! pool | |
(lambda() | |
(begin | |
(log (list "at" n)) | |
(sys-sleep 1) | |
)))) | |
ls) | |
(wait-all pool)))) | |
(run '(1 2 3 4 5 6 7 8 9)) | |
(log "finish") |
Author
karahiyo
commented
Jun 27, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment