Permalink
Browse files

eliminate :interrupted status race condition

  • Loading branch information...
cemerick committed Feb 14, 2012
1 parent f392614 commit f955b8c809fe1bae057b6eda8a4c69f3dbd3c213
Showing with 4 additions and 1 deletion.
  1. +4 −1 src/main/clojure/clojure/tools/nrepl/middleware/interruptible_eval.clj
@@ -97,10 +97,13 @@
(if-not thread
(t/send transport (response-for msg :status #{:done :session-idle}))
(do
- (.stop thread)
+ ; notify of the interrupted status before we .stop the thread so
+ ; it is received before the standard :done status (thereby ensuring
+ ; that is stays within the scope of a clojure.tools.nrepl/message seq
(t/send transport {:status #{:interrupted}
:id (:id eval-msg)
:session id})
+ (.stop thread)
(t/send transport (response-for msg :status #{:done}))))
(t/send transport (response-for msg :status #{:error :interrupt-id-mismatch :done}))))

0 comments on commit f955b8c

Please sign in to comment.