Week 1 - Run tasks in parallel
Hi,
When running two tasks in parallel, they are two ways of doing (if I understood the slides correctly).
In the following piece of code (slide 54) there is tA that is ran in the main thread, and tB in another one. What would change if we put tA in a task and join it at the end as well ? (as in slide 50) Is there one way better than the other ?
def parallel[A, B](cA: => A, cB: => B): (A, B) = {
val tB: Task[B] = task { cB }
val tA: A = cA
(tA, tB.join)
}
Thanks