Skip to content

Instantly share code, notes, and snippets.

@djspiewak
Created September 22, 2014 21:48
Show Gist options
  • Save djspiewak/ec901a75be5211a85b08 to your computer and use it in GitHub Desktop.
Save djspiewak/ec901a75be5211a85b08 to your computer and use it in GitHub Desktop.
import java.util.concurrent.ExecutorService
def fork[A](t: Task[A])(implicit pool: ExecutorService = Strategy.DefaultExecutorService): Task[A] = {
Task async { cb =>
t runAsync { either =>
pool.submit(new Runnable {
def run(): Unit = cb(either)
})
()
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment