Skip to content

Commit c99aaf4

Browse files
use interactive threadpool if possible
1 parent feb428a commit c99aaf4

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

base/client.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ function _start()
540540
elseif (repl_was_requested || is_interactive)
541541
# Run the Base `main`, which will either load the REPL stdlib
542542
# or run the fallback REPL
543-
ret = fetch(Threads.@spawn repl_main(ARGS))
543+
ret = fetch(Threads.@spawn :interactive repl_main(ARGS))
544544
end
545545
ret === nothing && (ret = 0)
546546
ret = Cint(ret)

stdlib/REPL/src/LineEdit.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ function beep(s::PromptState, duration::Real=options(s).beep_duration,
198198
isinteractive() || return # some tests fail on some platforms
199199
s.beeping = min(s.beeping + duration, maxduration)
200200
let colors = Base.copymutable(colors)
201-
errormonitor(Threads.@spawn begin
201+
errormonitor(Threads.@spawn :interactive begin
202202
trylock(s.refresh_lock) || return
203203
try
204204
orig_prefix = s.p.prompt_prefix
@@ -2829,7 +2829,7 @@ function prompt!(term::TextTerminal, prompt::ModalInterface, s::MIState = init_s
28292829
activate(prompt, s, term, term)
28302830
old_state = mode(s)
28312831
l = Base.ReentrantLock()
2832-
t = Threads.@spawn while true
2832+
t = Threads.@spawn :interactive while true
28332833
wait(s.async_channel)
28342834
status = @lock l begin
28352835
fcn = take!(s.async_channel)

stdlib/REPL/src/REPL.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -327,15 +327,15 @@ function start_repl_backend(repl_channel::Channel{Any}, response_channel::Channe
327327
# Maintain legacy behavior of asynchronous backend
328328
backend = REPLBackend(repl_channel, response_channel, false)
329329
# Assignment will be made twice, but will be immediately available
330-
backend.backend_task = Threads.@spawn start_repl_backend(backend; get_module)
330+
backend.backend_task = Threads.@spawn :interactive start_repl_backend(backend; get_module)
331331
return backend
332332
end
333333

334334
"""
335335
start_repl_backend(backend::REPLBackend)
336336
337337
Call directly to run backend loop on current Task.
338-
Use Threads.@spawn for run backend on new Task.
338+
Use Threads.@spawn :interactive for run backend on new Task.
339339
340340
Does not return backend until loop is finished.
341341
"""
@@ -495,12 +495,12 @@ function run_repl(repl::AbstractREPL, @nospecialize(consumer = x -> nothing); ba
495495
end
496496
get_module = () -> active_module(repl)
497497
if backend_on_current_task
498-
t = Threads.@spawn run_frontend(repl, backend_ref)
498+
t = Threads.@spawn :interactive run_frontend(repl, backend_ref)
499499
errormonitor(t)
500500
Base._wait2(t, cleanup)
501501
start_repl_backend(backend, consumer; get_module)
502502
else
503-
t = Threads.@spawn start_repl_backend(backend, consumer; get_module)
503+
t = Threads.@spawn :interactive start_repl_backend(backend, consumer; get_module)
504504
errormonitor(t)
505505
Base._wait2(t, cleanup)
506506
run_frontend(repl, backend_ref)
@@ -1266,7 +1266,7 @@ function setup_interface(
12661266
end
12671267
# load Pkg on another thread if available so that typing in the dummy Pkg prompt
12681268
# isn't blocked, but instruct the main REPL task to do the transition via s.async_channel
1269-
t_replswitch = Threads.@spawn begin
1269+
t_replswitch = Threads.@spawn :default begin
12701270
REPLExt = load_pkg()
12711271
if REPLExt isa Module && isdefined(REPLExt, :PkgCompletionProvider)
12721272
put!(s.async_channel,

0 commit comments

Comments
 (0)