@@ -2740,10 +2740,12 @@ end
27402740
27412741function run_interface (terminal:: TextTerminal , m:: ModalInterface , s:: MIState = init_state (terminal, m))
27422742 while ! s. aborted
2743- buf, ok, suspend = prompt! (terminal, m, s)
2743+ # spawn this so because the main repl task is sticky (due to use of @async and _wait2)
2744+ # and we want to not block typing when the repl task thread is busy
2745+ buf, ok, suspend = fetch (Threads. @spawn :interactive prompt! (terminal, m, s))
27442746 while suspend
27452747 @static if Sys. isunix (); ccall (:jl_repl_raise_sigtstp , Cint, ()); end
2746- buf, ok, suspend = prompt! (terminal, m, s)
2748+ buf, ok, suspend = fetch (Threads . @spawn :interactive prompt! (terminal, m, s) )
27472749 end
27482750 Base. invokelatest (mode (state (s)). on_done, s, buf, ok)
27492751 end
@@ -2829,7 +2831,7 @@ function prompt!(term::TextTerminal, prompt::ModalInterface, s::MIState = init_s
28292831 activate (prompt, s, term, term)
28302832 old_state = mode (s)
28312833 l = Base. ReentrantLock ()
2832- t = @async while true
2834+ t = Threads . @spawn :interactive while true
28332835 wait (s. async_channel)
28342836 status = @lock l begin
28352837 fcn = take! (s. async_channel)
0 commit comments