emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/async edd0656469: Test communication in both ways in as


From: ELPA Syncer
Subject: [elpa] externals/async edd0656469: Test communication in both ways in async-test-5
Date: Tue, 14 Mar 2023 06:57:21 -0400 (EDT)

branch: externals/async
commit edd06564699b8dd7edd9ba73704b568db09913ec
Author: Thierry Volpiatto <thievol@posteo.net>
Commit: Thierry Volpiatto <thievol@posteo.net>

    Test communication in both ways in async-test-5
---
 async-test.el | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/async-test.el b/async-test.el
index 3d7a64b364..496d6fe728 100644
--- a/async-test.el
+++ b/async-test.el
@@ -86,20 +86,19 @@
   (message "Starting async-test-4...done"))
 
 (defun async-test-5 ()
+  "Test communication between parent and child, both ways."
   (interactive)
   (message "Starting async-test-5...")
   (let ((proc
          (async-start
           ;; What to do in the child process
           (lambda ()
-            (message "This is a test, sending message")
+            ;; Send message to parent
             (async-send :hello "world")
-            ;; wait for a message
+            ;; wait for a message from parent
             (let ((msg (async-receive)))
-              (message "Child got message: %s"
-                       (plist-get msg :goodbye)))
-            (sleep-for 3)
-            222)
+              (sleep-for 3)
+              (plist-get msg :result)))
 
           ;; What to do when it finishes
           (lambda (result)
@@ -108,7 +107,8 @@
                          (plist-get result :hello))
               (message "Async process done, result should be 222: %s"
                        result))))))
-    (async-send proc :goodbye "everyone"))
+    ;; Send message to child process
+    (async-send proc :result "222"))
   (message "Starting async-test-5...done"))
 
 (defun async-test-6 ()
@@ -124,7 +124,6 @@
    (lambda (result)
      (message "Async process done: %s" result))))
 
-
 (provide 'async-test)
 
 ;;; async-test.el ends here



reply via email to

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