mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-23 20:15:05 +02:00
Use integrated lib
This commit is contained in:
parent
84f46476b4
commit
f9f106ee4d
1 changed files with 7 additions and 8 deletions
|
@ -2,16 +2,15 @@
|
|||
(import
|
||||
(scheme base)
|
||||
(scheme write)
|
||||
(shared-queue)
|
||||
(srfi 18)
|
||||
(cyclone concurrent))
|
||||
|
||||
(define q (make-queue))
|
||||
(define q (make-shared-queue))
|
||||
(define (consume)
|
||||
(%consume)
|
||||
(%consume))
|
||||
(define (%consume)
|
||||
(let ((val (queue-remove! q)))
|
||||
(let ((val (shared-queue-remove! q)))
|
||||
(if (procedure? val)
|
||||
(set! val (val)))
|
||||
(write `(removed ,val ,(current-thread)))
|
||||
|
@ -25,11 +24,11 @@
|
|||
(thread-start! t2)
|
||||
|
||||
(thread-sleep! 1)
|
||||
(queue-add! q 'a)
|
||||
(queue-add! q (lambda () (+ 1 2 3)))
|
||||
(queue-add! q 'c)
|
||||
(queue-add! q 'd)
|
||||
(queue-add! q 'e)
|
||||
(shared-queue-add! q 'a)
|
||||
(shared-queue-add! q (lambda () (+ 1 2 3)))
|
||||
(shared-queue-add! q 'c)
|
||||
(shared-queue-add! q 'd)
|
||||
(shared-queue-add! q 'e)
|
||||
|
||||
(thread-join! t1)
|
||||
(thread-join! t2)
|
||||
|
|
Loading…
Add table
Reference in a new issue