title: How this deadlock happens in Scala Future?
body: <p>This snippet is excerpted from <a href="https://monix.io/docs/3x/best-practices/blocking.html#if-blocking-use-scalas-blockcontext" rel="nofollow noreferrer">Monix document</a>.
  It's an example that how to enter deadlock in Scala.</p>
  
  <pre><code>import java.util.concurrent.Executors
  import scala.concurrent._
  implicit val ec = ExecutionContext.fromExecutor(Executors.newFixedThreadPool(1))
  
  def addOne(x: Int) = Future(x + 1)
  
  def multiply(x: Int, y: Int) = Future {
    val a = addOne(x)
    val b = addOne(y)
    val result = for (r1 &lt;- a; r2 &lt;- b) yield r1 * r2
  
    // This can dead-lock due to the limited size of our thread-pool!
    Await.result(result, Duration.Inf)
  }
  </code></pre>
  
  <p>I understand what the code does, but not about how it executed.</p>
  
  <p>Why it is the line <code>Await.result(result, Duration.Inf)</code> causing the deadlock ? (Yes, I tested it)</p>
  
  <p>Is not that the outermost <code>Future</code> at multiply function occupy all the thread pool(the single one) and thus deadlock (because the addOne future is forever blocked on waiting for thread)?   </p>