gnunet-svn
[Top][All Lists]
Advanced

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

[gnunet-scheme] 03/04: concurrency/lost-and-found: Make guarding objects


From: gnunet
Subject: [gnunet-scheme] 03/04: concurrency/lost-and-found: Make guarding objects optional.
Date: Wed, 16 Feb 2022 22:19:09 +0100

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 7ac903a1727fbedd70d70d1ea32b0f17311a1191
Author: Maxime Devos <maximedevos@telenet.be>
AuthorDate: Wed Feb 16 21:17:12 2022 +0000

    concurrency/lost-and-found: Make guarding objects optional.
    
    dht/client strictly speaking does not need this, but this seems
    a bit neater and avoids some memory usage.
    
    * gnu/gnunet/concurrency/lost-and-found.scm (<losable>)[protocol]:
      Don't guard when 'lost-and-found' is false.
---
 gnu/gnunet/concurrency/lost-and-found.scm | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/gnu/gnunet/concurrency/lost-and-found.scm 
b/gnu/gnunet/concurrency/lost-and-found.scm
index 8975240..050bd4a 100644
--- a/gnu/gnunet/concurrency/lost-and-found.scm
+++ b/gnu/gnunet/concurrency/lost-and-found.scm
@@ -216,15 +216,17 @@ wakeups where the empty list is returned are possible."
 
     (define *guard* (make-guardian))
 
+    ;; TODO: test the 'lost-and-found=#false' case.
     (define-record-type (<losable> make-losable losable?)
       (fields (immutable lost-and-found losable-lost-and-found))
       (sealed #false)
       (protocol (lambda (%make)
-                 (lambda (lost-and-found)
-                   (assert (lost-and-found? lost-and-found))
-                   (let ((object (%make lost-and-found)))
-                     (*guard* object)
-                     object)))))
+                 (lambda (lost-and-found)
+                   (let ((object (%make lost-and-found)))
+                     (when lost-and-found
+                       (assert (lost-and-found? lost-and-found))
+                       (*guard* object))
+                     object)))))
 
     (define (collect-lost)
       (define object (*guard*))

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