With julia-1.9, should the main task block :interactive tasks?

According to

julia> Threads.threadpool()
:default

the main task shouldn’t be using the :interactive thread pool, but whenever I run a busy loop on the main thread, any tasks spawned from the :interactive thread pool are blocked. Is the main task special in some way?

Examples (both started with -t2,2):

julia> Threads.@spawn :interactive while true
         sleep(1)
         println("hello")
       end
       while true
       end

(no output, the :interactive task is blocked)

julia> Threads.@spawn :interactive while true
         sleep(1)
         println("hello")
       end
       t = Threads.@spawn while true
       end
       wait(t)
hello
hello
hello

(works as expected)

Sorry for reviving this older thread, but I have the same question. Here’s another similar/same example where julia is started with julia -t 1,1, and the method “bar” blocks the method “foo”, which is not what I expected. This is with Julia 1.9.3.

function foo()
    x = 0
    tic = time()
    while true
        if time() - tic > 30
            break
        end
        println("inside interactive loop, x=$x")
        x += 1
        sleep(1)
    end
end

function bar()
    x = 1
    c = -1
    d = 3
    tic = time()
    while true
        if time() - tic > 30
            break
        end
        x += c/d
        c *= -1
        d += 2
    end
    @info "bar, after 30 seconds, pi is $(4*x)"
end

tsk = Threads.@spawn :interactive foo()
bar()
wait(tsk)

output:

[ Info: bar, after 30 seconds, pi is 3.1415926521589954
inside interactive loop, x=0
inside interactive loop, x=1
inside interactive loop, x=2
inside interactive loop, x=3
inside interactive loop, x=4
inside interactive loop, x=5
inside interactive loop, x=6
inside interactive loop, x=7
inside interactive loop, x=8
inside interactive loop, x=9
inside interactive loop, x=10
inside interactive loop, x=11
inside interactive loop, x=12
inside interactive loop, x=13
inside interactive loop, x=14
inside interactive loop, x=15
inside interactive loop, x=16
inside interactive loop, x=17
inside interactive loop, x=18
inside interactive loop, x=19
inside interactive loop, x=20
inside interactive loop, x=21
inside interactive loop, x=22
inside interactive loop, x=23
inside interactive loop, x=24
inside interactive loop, x=25
inside interactive loop, x=26
inside interactive loop, x=27
inside interactive loop, x=28
inside interactive loop, x=29

Here’s the answer. I ran the above code in the REPL, and the REPL is running in an interactive thread. So, the REPL is what is blocking the “foo” method. Running julia -t 1,1 myscript.jl behaves as expected. In addition, running from the REPL with julia -t 1,2 also behaves as expected.