Skip to content

Instantly share code, notes, and snippets.

@nkoguro
Created May 30, 2020
Embed
What would you like to do?
(use control.thread-pool)
(use gauche.partcont)
(use gauche.threads)
(define pool (make-thread-pool 1))
(define (wrap thunk)
(lambda ()
(reset
(thunk))))
(define (yield)
(shift cont
(add-job! pool (wrap cont))))
(define (main args)
(add-job! pool (wrap (lambda ()
(let1 counter 0
(while #t
(inc! counter)
(when (= counter 100000)
(set! counter 0)
(format #t "~s~%" (gc-stat)))
(yield))))))
(thread-sleep! 1000000000)
0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment