Remove damn quasi-quote, do more work

This commit is contained in:
Justin Ethier 2016-01-16 22:19:30 -05:00
parent 079c6f4390
commit 308d1ce206

View file

@ -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)