gnunet-svn
[Top][All Lists]
Advanced

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

[gnunet-scheme] 193/324: mq-impl/stream: Eliminate condition variable.


From: gnunet
Subject: [gnunet-scheme] 193/324: mq-impl/stream: Eliminate condition variable.
Date: Tue, 21 Sep 2021 13:23:53 +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 ff2bdd71326d30fa6232bd261bb1ae0d11192b32
Author: Maxime Devos <maximedevos@telenet.be>
AuthorDate: Sat Aug 21 13:19:49 2021 +0200

    mq-impl/stream: Eliminate condition variable.
    
    Only spawning the 'handle-input!' and 'handle-output!' fiber
    once the connection has been made eliminates the need for
    the 'socket-connected?' condition and simplifies the code
    somewhat.
    
    * gnu/gnunet/mq-impl/stream.scm
      (connect/fibers): Eliminate 'socket-connected?'.
---
 gnu/gnunet/mq-impl/stream.scm | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/gnu/gnunet/mq-impl/stream.scm b/gnu/gnunet/mq-impl/stream.scm
index 48ad549..2a56959 100644
--- a/gnu/gnunet/mq-impl/stream.scm
+++ b/gnu/gnunet/mq-impl/stream.scm
@@ -266,18 +266,16 @@ the error @code{input:regular-end-of-file} is injected 
into the message queue."
       (define (interrupt! mq)
        (trigger-condition! rcvar))
       (define wait! (cut await-trigger! rcvar))
-      (define socket-connected? (make-condition))
       (let ((mq (make-message-queue handlers error-handler interrupt!)))
-       (spawn (lambda ()
-                (wait socket-connected?)
-                (handle-input! mq (atomic-box-ref socket/box))))
-       (spawn (lambda ()
-                (wait socket-connected?)
-                (handle-output! mq (atomic-box-ref socket/box) wait!)))
        (spawn (lambda ()
                 (atomic-box-set! socket/box
                                  (connect-unix config service-name))
                 (inject-error! mq 'connection:connected)
-                (signal-condition! socket-connected?)))
+                (spawn
+                 (lambda ()
+                   (handle-input! mq (atomic-box-ref socket/box))))
+                (spawn
+                 (lambda ()
+                   (handle-output! mq (atomic-box-ref socket/box) wait!)))))
        mq))))
 

-- 
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]