Skip to content

Instantly share code, notes, and snippets.

@nkoguro
Created Jun 14, 2020
Embed
What would you like to do?
(use data.queue)
(use gauche.partcont)
(define queue (make-queue))
(define (make-worker)
(make-thread (lambda ()
(while (dequeue! queue #f)
=> next
(print "==> call next")
(reset
(dynamic-wind
(lambda ()
(print "start"))
next
(lambda ()
(print "end"))))))))
(define (yield)
(shift cont
(enqueue! queue cont)))
(define (main args)
(enqueue! queue (lambda ()
(guard (e (else (print "catch error!!")))
(yield)
(error "err"))))
(while (dequeue! queue #f)
=> next
(print "==> call next")
(reset
(dynamic-wind
(lambda ()
(print "start"))
next
(lambda ()
(print "end")))))
0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment