]> git.eshelyaron.com Git - dict.git/commitdiff
FIXED: possible race condition when signaling new top-level threads
authorEshel Yaron <me@eshelyaron.com>
Sat, 21 Jan 2023 20:46:35 +0000 (22:46 +0200)
committerEshel Yaron <me@eshelyaron.com>
Sat, 21 Jan 2023 20:47:39 +0000 (22:47 +0200)
sweeprolog.el

index c434096507e90d6305f569b5566172287da022da..33aa182852a3090e3fd767fddf3d110a31a45299 100644 (file)
@@ -2848,9 +2848,8 @@ appropriate buffer."
                             (and (derived-mode-p 'sweeprolog-top-level-mode)
                                  sweeprolog-top-level-thread-id)))))
          (read-string "Signal goal: ?- ")))
-  (sweeprolog-signal-thread (buffer-local-value 'sweeprolog-top-level-thread-id
-                                                (get-buffer buffer))
-                            goal))
+  (with-current-buffer (get-buffer buffer)
+    (sweeprolog-top-level-signal-current goal)))
 
 (defun sweeprolog-top-level-signal-current (goal)
   "Signal the current top-level thread to run GOAL.
@@ -2862,6 +2861,8 @@ GOAL.  Otherwise, GOAL is set to a default value specified by
                          (read-string "Signal goal: ?- " nil
                                       'sweeprolog-top-level-signal-goal-history)
                        sweeprolog-top-level-signal-default-goal)))
+  (unless sweeprolog-top-level-thread-id
+    (sweeprolog-top-level--populate-thread-id))
   (sweeprolog-signal-thread sweeprolog-top-level-thread-id goal))
 
 ;;;###autoload