Skip to content

Instantly share code, notes, and snippets.

Created May 30, 2020
What would you like to do?
(use data.queue)
(use gauche.partcont)
(define queue (make-queue))
(define (wrap thunk)
(lambda ()
;; Add guard here!!
(guard (e (else (raise e)))
(define (yield)
(shift cont
(enqueue! queue (wrap cont))))
(define (main args)
(enqueue! queue (wrap (lambda ()
(let1 counter 0
(while #t
(inc! counter)
(when (= counter 100000)
(set! counter 0)
(format #t "~s~%" (gc-stat)))
(while #t
(let1 next (dequeue! queue #f)
(when next
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment