quit patch
This commit is contained in:
+16
-5
@@ -98,6 +98,11 @@
|
|||||||
(define (get)
|
(define (get)
|
||||||
(uni-channel-get ch-in))
|
(uni-channel-get ch-in))
|
||||||
|
|
||||||
|
(define (close-and-wait ch)
|
||||||
|
(when ch
|
||||||
|
(uni-channel-close ch)
|
||||||
|
(uni-channel-wait ch)))
|
||||||
|
|
||||||
(define (audio-read-worker ao-dec file-id)
|
(define (audio-read-worker ao-dec file-id)
|
||||||
(set! feeding-audio #t)
|
(set! feeding-audio #t)
|
||||||
(set! play-thread
|
(set! play-thread
|
||||||
@@ -481,11 +486,17 @@
|
|||||||
))])
|
))])
|
||||||
|
|
||||||
(cond
|
(cond
|
||||||
((eq? cmd 'quit) (do-rpc
|
((eq? cmd 'quit)
|
||||||
(stop-and-cleanup)
|
;; Quit is the one RPC where the acknowledgement must be written
|
||||||
(set! player-state 'quit)
|
;; before the worker starts tearing down its audio state and stdio
|
||||||
(state "quit" evt 'force)
|
;; transport. For port-based uni-channels, put is asynchronous:
|
||||||
'(quit)))
|
;; close-and-wait makes sure the queued '(quit) has actually been
|
||||||
|
;; written and flushed before the process exits.
|
||||||
|
(put '(quit))
|
||||||
|
(close-and-wait ch-out)
|
||||||
|
(stop-and-cleanup)
|
||||||
|
(set! player-state 'quit)
|
||||||
|
(close-and-wait ch-evt))
|
||||||
((eq? cmd 'init) (do-rpc
|
((eq? cmd 'init) (do-rpc
|
||||||
(set! ch-out (->uni-channel (cadr data)))
|
(set! ch-out (->uni-channel (cadr data)))
|
||||||
(set! ch-evt (->uni-channel (caddr data)))
|
(set! ch-evt (->uni-channel (caddr data)))
|
||||||
|
|||||||
Reference in New Issue
Block a user