質問

I have two functions (f : Unit => T, g : Unit => U) for some types T, U. I want to run these two functions in parallel (equivalently on different threads). I want the main thread to wait for the two function calls to terminate and also get the result of both function calls. I was wondering what the best way to do this in Scala was. I have looked into Actors and Parallel Collections but can't find a way to do what I want. Any help would be appreciated.

役に立ちましたか?

解決

You may want to look at Futures module. Its method join allows to wait for results of two concurrent computations with different types.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top