mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-19 13:49:16 +02:00
Remove damn quasi-quote, do more work
This commit is contained in:
parent
079c6f4390
commit
308d1ce206
1 changed files with 7 additions and 4 deletions
|
@ -15,10 +15,11 @@
|
||||||
(define *queue* (->heap (list)))
|
(define *queue* (->heap (list)))
|
||||||
|
|
||||||
(define (producer)
|
(define (producer)
|
||||||
(let loop ((n 10))
|
(let loop ((n 100))
|
||||||
(cond
|
(cond
|
||||||
((> n 0)
|
((> n 0)
|
||||||
(mutex-lock! *lock*)
|
(mutex-lock! *lock*)
|
||||||
|
(write (cons 'a *queue*))
|
||||||
(set! *queue* (->heap (cons (->heap n) *queue*)))
|
(set! *queue* (->heap (cons (->heap n) *queue*)))
|
||||||
(mutex-unlock! *lock*)
|
(mutex-unlock! *lock*)
|
||||||
(loop (- n 1)))
|
(loop (- n 1)))
|
||||||
|
@ -39,7 +40,7 @@
|
||||||
;; - try compiling this but commenting out the Cyc_mutex_lock
|
;; - try compiling this but commenting out the Cyc_mutex_lock
|
||||||
;; code in the C. there is a gc_move bag tag error at runtime
|
;; code in the C. there is a gc_move bag tag error at runtime
|
||||||
;; also get the same result by using read-char below... WTF?
|
;; also get the same result by using read-char below... WTF?
|
||||||
(read-char) ;(mutex-lock! *lock*)`
|
(mutex-lock! *lock*)
|
||||||
(cond
|
(cond
|
||||||
((not (null? *queue*))
|
((not (null? *queue*))
|
||||||
(write (car *queue*))
|
(write (car *queue*))
|
||||||
|
@ -52,7 +53,9 @@
|
||||||
(loop)
|
(loop)
|
||||||
))
|
))
|
||||||
|
|
||||||
;(thread-start! (make-thread producer))
|
(thread-start! (make-thread producer))
|
||||||
;(producer)
|
(thread-start! (make-thread producer))
|
||||||
|
(thread-start! (make-thread producer))
|
||||||
|
(producer)
|
||||||
(consumer)
|
(consumer)
|
||||||
;(read)
|
;(read)
|
||||||
|
|
Loading…
Add table
Reference in a new issue