mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-15 00:37:35 +02:00
Cleaned up demo
This commit is contained in:
parent
04d1655a6a
commit
d0bce4a15e
1 changed files with 2 additions and 13 deletions
|
@ -1,27 +1,17 @@
|
|||
;; Simple example demonstrating many threads concurrently writing data to stdout
|
||||
(import
|
||||
(scheme base)
|
||||
(scheme read)
|
||||
(scheme write)
|
||||
(srfi 18))
|
||||
|
||||
;; should not be necessary, just testing
|
||||
;; TODO: noticed gc_move error with mutex... may be a GC issue
|
||||
;(define m (make-mutex))
|
||||
|
||||
(define (write-forever val)
|
||||
; (mutex-lock! m)
|
||||
(write val)
|
||||
; (list 1)
|
||||
; (mutex-unlock! m)
|
||||
(write-forever val))
|
||||
|
||||
(define (make-writer val)
|
||||
(lambda () (write-forever val)))
|
||||
|
||||
;; Try moving closures to heap prior to using threads
|
||||
;; TODO: needed?
|
||||
(Cyc-minor-gc)
|
||||
|
||||
(thread-start!
|
||||
(make-thread
|
||||
(make-writer "thread 1")))
|
||||
|
@ -31,6 +21,5 @@
|
|||
(thread-start!
|
||||
(make-thread
|
||||
(make-writer 'thread-3)))
|
||||
;; TODO: when main runs the process crashes, but otherwise it seems stable. WTF?
|
||||
((make-writer 'main))
|
||||
(read)
|
||||
;(read)
|
||||
|
|
Loading…
Add table
Reference in a new issue