From 68e5177dabf0b85c3855cbb8b942a1165563a0c3 Mon Sep 17 00:00:00 2001 From: ian Date: Thu, 1 Jun 2017 16:34:07 -0400 Subject: [PATCH] Fix formatting of code snippets in Future docs --- overviews/core/_posts/2012-09-20-futures.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/overviews/core/_posts/2012-09-20-futures.md b/overviews/core/_posts/2012-09-20-futures.md index e2d5cd2f6c..946e060262 100644 --- a/overviews/core/_posts/2012-09-20-futures.md +++ b/overviews/core/_posts/2012-09-20-futures.md @@ -121,7 +121,7 @@ As explained in the `ForkJoinPool` API, this is only possible if the pool is exp Fortunately the concurrent package provides a convenient way for doing so: import scala.concurrent.Future - import scala.concurrent.blocking + import scala.concurrent.blocking Future { blocking { @@ -165,16 +165,16 @@ One might be tempted to have an `ExecutionContext` that runs computations within val currentThreadExecutionContext = ExecutionContext.fromExecutor( new Executor { - // Do not do this! + // Do not do this! def execute(runnable: Runnable) { runnable.run() } }) This should be avoided as it introduces non-determinism in the execution of your future. Future { - doSomething - }(ExecutionContext.global).map { - doSomethingElse + doSomething + }(ExecutionContext.global).map { + doSomethingElse }(currentThreadExecutionContext) The `doSomethingElse` call might either execute in `doSomething`'s thread or in the main thread, and therefore be either asynchronous or synchronous.