291 - figured out the channel-handoff problem
'read' and 'write' pass in the channel by value, so they block on different *local* variables. Does this kill my plan to pervasively use call-by-value everywhere? No, we might be able to salvage it if channels are the only shared pointers.
This commit is contained in:
parent
527a0ebef8
commit
51370addc9
11
mu.arc
11
mu.arc
|
@ -184,8 +184,9 @@
|
|||
(> curr-cycle* rep.routine!sleep.0)
|
||||
(ret result nil
|
||||
(= routine* routine)
|
||||
;? (tr "checking location " rep.routine*!sleep)
|
||||
;? (tr "checking location " rep.routine*!sleep " -> " (addr rep.routine*!sleep))
|
||||
(= result (~in (m rep.routine!sleep) 0 nil))
|
||||
;? (tr (if result "yep" "nope"))
|
||||
(= routine* nil))))
|
||||
|
||||
(on-init
|
||||
|
@ -229,6 +230,7 @@
|
|||
; wake up any necessary sleeping routines (either by time or on a location)
|
||||
; detect deadlock: kill all sleeping routines when none can be woken
|
||||
(def update-scheduler-state ()
|
||||
;? (trace "schedule" curr-cycle*)
|
||||
(when routine*
|
||||
(if
|
||||
rep.routine*!sleep
|
||||
|
@ -257,7 +259,8 @@
|
|||
(detect-deadlock))
|
||||
|
||||
(def detect-deadlock ()
|
||||
(when (and empty.running-routines*
|
||||
(when (and (empty running-routines*)
|
||||
(~empty sleeping-routines*)
|
||||
(~some 'literal (map (fn(_) rep._!sleep.1)
|
||||
keys.sleeping-routines*)))
|
||||
(each (routine _) sleeping-routines*
|
||||
|
@ -555,7 +558,9 @@
|
|||
(let delay v.operand
|
||||
(trace "run" "sleeping until " (+ curr-cycle* delay))
|
||||
(= rep.routine*!sleep `(,(+ curr-cycle* delay) literal)))
|
||||
(= rep.routine*!sleep operand))
|
||||
(do
|
||||
;? (tr "blocking on " operand " -> " (addr operand))
|
||||
(= rep.routine*!sleep operand)))
|
||||
((abort-routine*)))
|
||||
|
||||
; text interaction
|
||||
|
|
4
mu.arc.t
4
mu.arc.t
|
@ -2316,7 +2316,9 @@
|
|||
((ochan channel-address) <- arg)
|
||||
((x tagged-value-address) <- new-tagged-value (integer-address literal) (n integer-address))
|
||||
((ochan channel-address deref) <- write (ochan channel-address deref) (x tagged-value-address deref)))))
|
||||
;? (= dump-trace* (obj whitelist '("run")))
|
||||
(set dump-trace*)
|
||||
;? (= dump-trace* (obj whitelist '("schedule" "run" "addr")))
|
||||
;? (= dump-trace* (obj whitelist '("-")))
|
||||
(run 'f1)
|
||||
;? (prn memory*)
|
||||
(each routine completed-routines*
|
||||
|
|
Loading…
Reference in New Issue
Block a user