<p dir="auto">Currently the scheduler through the <code class="notranslate">Threads.@spawn</code> macro will assign to random thread #'s, including the primary thread.  There may be times where there is a "traffic cop" activity on Thread 1 that can be impacted if a heavy-computational (in essence, blocking) task is put onto that thread.  It would be nice if there was a way to cordon off Thread 1 from spawning in those cases.</p>
<p dir="auto">If I run the following code in a REPL (v0.4.5), I find that the REPL becomes very unresponsive. It will take many seconds to respond to just typing a few letters. In contrast, if I run the same code in an iJulia notebook, the iJulia notebook remains responsive to typing, even if it takes longer to evaluate things. It would be nice if the REPL remained responsive as well.</p>
<div class="highlight highlight-source-julia notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="function dowork(n)
       t = 0.0
       for i=1:n
       t+= @elapsed sort(rand(10^5))
       yield()
       end
       t
       end

 for i=1:100 @schedule dowork(1000) end"><pre class="notranslate"><span class="pl-k">function</span> <span class="pl-en">dowork</span>(n)
       t <span class="pl-k">=</span> <span class="pl-c1">0.0</span>
       <span class="pl-k">for</span> i<span class="pl-k">=</span><span class="pl-c1">1</span><span class="pl-k">:</span>n
       t<span class="pl-k">+=</span> <span class="pl-c1">@elapsed</span> <span class="pl-c1">sort</span>(<span class="pl-c1">rand</span>(<span class="pl-c1">10</span><span class="pl-k">^</span><span class="pl-c1">5</span>))
       <span class="pl-c1">yield</span>()
       <span class="pl-k">end</span>
       t
       <span class="pl-k">end</span>

 <span class="pl-k">for</span> i<span class="pl-k">=</span><span class="pl-c1">1</span><span class="pl-k">:</span><span class="pl-c1">100</span> <span class="pl-c1">@schedule</span> <span class="pl-c1">dowork</span>(<span class="pl-c1">1000</span>) <span class="pl-k">end</span></pre></div>