Wish: I believe currently the only way to get a return value from a ResumableSub is to use Wait For. However, I would like to asynchronously call several ResumableSubs that all have return values. If there was a Result function on the ResumableSub object, I believe this would allow for cleaner code.
Note: I have already implemented a workaround that achieves the desired result; the workaround code just isn't as straightforward.
Note: I have already implemented a workaround that achieves the desired result; the workaround code just isn't as straightforward.
Result from ResumableSub object:
Public Sub LoadTable1() As ResumableSub
Dim somemap1 as Map
'...Call and wait on some REST function over the Internet which might take a while
return somemap1
End Sub
Public Sub LoadTable2() As ResumableSub
Dim somemap2 as Map
'...Call and wait on some REST function over the Internet which might take a while
return somemap2
End Sub
Public Sub LoadTable3() As ResumableSub
Dim somemap3 as Map
'...Call and wait on some REST function over the Internet which might take a while
return somemap3
End Sub
Public Sub LoadTablesAndDoSomething
Dim rs1 As ResumableSub = CallSub(Starter, "LoadTable1")
Dim rs2 As ResumableSub = CallSub(Starter, "LoadTable2")
Dim rs3 As ResumableSub = CallSub(Starter, "LoadTable3")
If Not(rs1.Completed) Then
Wait For(rs1) Complete
End If
If Not(rs2.Completed) Then
Wait For(rs2) Complete
End If
If Not(rs3.Completed) Then
Wait For(rs3) Complete
End If
Dim Table1Map as Map = rs1.Result '<<< Example of wished-for function "Result"
Dim Table2Map as Map = rs2.Result '<<< Example of wished-for function "Result"
Dim Table3Map as Map = rs3.Result '<<< Example of wished-for function "Result"
'...Do something else
End Sub