In C# you can write:
var alphaTask = Task.Factory.StartNew<alpha>(() =>
{
return someWork(n);<br>
});
// ... do some other work, and later get the result from the task<br>
var res = alphaTask.Result;
How would this simple construction look like in Scala?
Thank you.
In Scala 2.8, the simplest equivalent would be
val future = Futures.future{
someWork(n)
}
// ... do some other work, and later get the result from the task
val res = future();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With