Spawn main is permitted to return a straight state
This commit is contained in:
parent
a40dbe0d97
commit
d656694eb1
15
os2.rkt
15
os2.rkt
|
@ -476,13 +476,18 @@
|
|||
(match-define (endpoint (eid pid _) _ (handlers _ _ message-handler)) e)
|
||||
(run-trapk state pid message-handler message-topic body)))
|
||||
|
||||
(define (maybe-transition->transition t)
|
||||
(cond [(transition? t) t]
|
||||
[else (transition t '())]))
|
||||
|
||||
(define (do-spawn spawning-pid main k debug-name state)
|
||||
(define new-pid (vm-next-process-id state))
|
||||
(define new-name (or debug-name new-pid))
|
||||
(match-define (transition initial-state initial-actions)
|
||||
(cond
|
||||
[(procedure? main) (send-to-user (lambda (e) (transition #f (kill #f e))) main new-pid)]
|
||||
[(transition? main) main]))
|
||||
(maybe-transition->transition
|
||||
(cond
|
||||
[(procedure? main) (send-to-user (lambda (e) (transition #f (kill #f e))) main new-pid)]
|
||||
[(transition? main) main])))
|
||||
(define initial-process (process new-name new-pid initial-state (set) (set)))
|
||||
(define spawned-state
|
||||
(struct-copy vm (enqueue-actions state new-pid initial-actions)
|
||||
|
@ -531,10 +536,6 @@
|
|||
(run-ready state pid (apply send-to-user failure-proc trap-k args)))
|
||||
state))
|
||||
|
||||
(define (maybe-transition->transition t)
|
||||
(cond [(transition? t) t]
|
||||
[else (transition t '())]))
|
||||
|
||||
(define (run-ready state pid interrupt-k)
|
||||
(define old-state (process-state (hash-ref (vm-processes state) pid)))
|
||||
(match-define (transition new-state actions)
|
||||
|
|
Loading…
Reference in New Issue