Skip to content

Instantly share code, notes, and snippets.

@bhauman
Created February 10, 2017 16:30
Show Gist options
  • Save bhauman/b6d71c1c4fb3648b00c80803c56c8f6f to your computer and use it in GitHub Desktop.
Save bhauman/b6d71c1c4fb3648b00c80803c56c8f6f to your computer and use it in GitHub Desktop.
demonstrating where to place thread/interupted
From: Bruce Hauman <bhauman@gmail.com>
Date: Fri, 10 Feb 2017 11:26:46 -0500
Subject: [PATCH] CLJS-ThreadIterrupt: Check for thread interuptions for
cleaner shutdown in some cases
---
src/main/clojure/cljs/repl.cljc | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/main/clojure/cljs/repl.cljc b/src/main/clojure/cljs/repl.cljc
index a223812..fc2a3f8 100644
--- a/src/main/clojure/cljs/repl.cljc
+++ b/src/main/clojure/cljs/repl.cljc
@@ -892,11 +892,13 @@
(flush)
(loop []
(when-not
- (try
- (identical? (read-eval-print) request-exit)
- (catch Throwable e
- (caught e repl-env opts)
- nil))
+ (or
+ (Thread/interrupted)
+ (try
+ (identical? (read-eval-print) request-exit)
+ (catch Throwable e
+ (caught e repl-env opts)
+ nil)))
(when (need-prompt)
(prompt)
(flush))
--
2.6.4 (Apple Git-63)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment