Repair incorrect interleaving of actions and scripts
This commit is contained in:
parent
3c4076287e
commit
f3ca2b6a15
|
@ -367,7 +367,8 @@
|
|||
[(quit)
|
||||
(apply-patch! ds ac (actor-cleanup-changes ac))]
|
||||
[(deferred-turn k)
|
||||
(push-script! ac k)]))))
|
||||
(push-script! ac k)])
|
||||
(run-all-pending-scripts! ds))))
|
||||
|
||||
(define (apply-patch! ds ac delta)
|
||||
(define ds-assertions (dataspace-assertions ds))
|
||||
|
@ -389,7 +390,8 @@
|
|||
;; TODO: figure out when a dataspace should quit itself. Given the
|
||||
;; mutable nature of the implementation, maybe never? It might be
|
||||
;; being held elsewhere!
|
||||
(not (null? (dataspace-runnable ds))))
|
||||
(not (and (null? (dataspace-runnable ds))
|
||||
(queue-empty? (dataspace-pending-actions ds)))))
|
||||
|
||||
(define (add-facet! where actor parent boot-proc)
|
||||
(when (and (not (in-script?)) where)
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
#lang imperative-syndicate/test-implementation
|
||||
|
||||
(test-case
|
||||
[(message-struct toggle ())
|
||||
(spawn* #:name 'flip-flop
|
||||
(define (even)
|
||||
(react (stop-when (message (toggle)) (odd))
|
||||
(on-start (printf "+even\n"))
|
||||
(on-stop (printf "-even\n"))))
|
||||
(define (odd)
|
||||
(react (stop-when (message (toggle)) (even))
|
||||
(on-start (printf "+odd\n"))
|
||||
(on-stop (printf "-odd\n"))))
|
||||
(even))
|
||||
(spawn* #:name 'main
|
||||
(until (asserted (observe (toggle))))
|
||||
(send! (toggle))
|
||||
(send! (toggle))
|
||||
(send! (toggle)))]
|
||||
no-crashes
|
||||
(expected-output "+even"
|
||||
"-even"
|
||||
"+odd"
|
||||
"-odd"
|
||||
"+even"
|
||||
"-even"
|
||||
"+odd"))
|
Loading…
Reference in New Issue