gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnunet-scheme] 219/324: mq-impl/stream: Create the message queue as lat


From: gnunet
Subject: [gnunet-scheme] 219/324: mq-impl/stream: Create the message queue as late as possible.
Date: Tue, 21 Sep 2021 13:24:19 +0200

This is an automated email from the git hooks/post-receive script.

maxime-devos pushed a commit to branch master
in repository gnunet-scheme.

commit bead4c65534003a23e6a0c8982e47f52398f7d4a
Author: Maxime Devos <maximedevos@telenet.be>
AuthorDate: Wed Sep 1 15:27:50 2021 +0200

    mq-impl/stream: Create the message queue as late as possible.
    
    This will make it simple to unify connect/fibers and
    port->message-queue.
    
    * gnu/gnunet/mq-impl/stream.scm
      (port->message-queue)[start-reader!,start-writer!]: Add 'mq'
      argument.
      (port->message-queue)[mq]: Construct it just before calling 'spawn'.
---
 gnu/gnunet/mq-impl/stream.scm | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/gnu/gnunet/mq-impl/stream.scm b/gnu/gnunet/mq-impl/stream.scm
index a8d0606..3289ee4 100644
--- a/gnu/gnunet/mq-impl/stream.scm
+++ b/gnu/gnunet/mq-impl/stream.scm
@@ -280,8 +280,7 @@ XXX: Likewise for connect/fibers?"
       ;; it informs the other fiber by signalling the condition and injects
       ;; an appropriate error, unless the other fiber will do it already.
       (define closed-condition (make-condition))
-      (define mq (make-message-queue handlers error-handler interrupt!))
-      (define (start-reader!)
+      (define (start-reader! mq)
        (define-values (key . rest)
          (let/ec escape
            (define wait-op
@@ -300,7 +299,7 @@ XXX: Likewise for connect/fibers?"
              (handle-input! mq port #:return values))))
        (when (signal-condition! closed-condition)
          (apply inject-error! mq key rest)))
-      (define (start-writer!)
+      (define (start-writer! mq)
        (let/ec escape
          ;; operation for calling the escape continuation when
          ;; when the other fiber detected the connection is broken
@@ -339,8 +338,10 @@ XXX: Likewise for connect/fibers?"
            (handle-output! mq port wait!)))
        (when (signal-condition! closed-condition)
          (inject-error! mq 'input:regular-end-of-file)))
-      (spawn start-reader!)
-      (spawn start-writer!)
+      (define mq
+       (make-message-queue handlers error-handler interrupt!))
+      (spawn (lambda () (start-reader! mq)))
+      (spawn (lambda () (start-writer! mq)))
       mq)
 
     (define* (connect/fibers config service-name handlers error-handler

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]