From: Christopher Allan Webber Date: Tue, 8 Aug 2017 18:45:39 +0000 (-0500) Subject: Update actor io behavior to not break on new fibers/scheduling system. X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=03f6862f84803d635a0513e5514f78eccb26e51d;p=8sync.git Update actor io behavior to not break on new fibers/scheduling system. * 8sync/actors.scm (%suspend-io-to-actor, suspend-read-to-actor) (suspend-write-to-actor): Update to be a bit more agnostic about the underlying scheduling system now... instead, we simply spawn a fiber and use the underlying wait-for-readable/wait-for-writeable mechanisms. --- diff --git a/8sync/actors.scm b/8sync/actors.scm index 83c6a92..05502fd 100644 --- a/8sync/actors.scm +++ b/8sync/actors.scm @@ -32,7 +32,6 @@ #:use-module (fibers channels) #:use-module (fibers conditions) #:use-module (fibers operations) - #:use-module (fibers internal) #:use-module (8sync inbox) #:use-module (8sync rmeta-slot) @@ -459,16 +458,14 @@ and handling them." ;; spawn a fiber that wakes up a thunk on the actor when its port is ;; available. Funky... -(define (%suspend-io-to-actor resume-method get-wait-fd-method) +(define (%suspend-io-to-actor wait-for-read/write) (lambda (port) (define prompt (*actor-prompt*)) (define resume-channel (*resume-io-channel*)) (define (run-at-prompt k) (spawn-fiber (lambda () - (suspend-current-fiber - (lambda (fiber) - (resume-on-readable-fd (port-read-wait-fd port) fiber))) + (wait-for-read/write port) ;; okay, we're awake again, tell the actor to resume this ;; continuation (put-message resume-channel k)) @@ -479,10 +476,10 @@ and handling them." 'run-me run-at-prompt))) (define suspend-read-to-actor - (%suspend-io-to-actor resume-on-readable-fd port-read-wait-fd)) + (%suspend-io-to-actor (@@ (fibers) wait-for-readable))) (define suspend-write-to-actor - (%suspend-io-to-actor resume-on-writable-fd port-write-wait-fd)) + (%suspend-io-to-actor (@@ (fibers) wait-for-writable))) (define (with-actor-nonblocking-ports thunk) "Runs THUNK in dynamic context in which attempting to read/write