Thanks, Markus. So if these subs all need to return a value, then I have to use "wait for" for all of them? This is not that convenient though.
And I find that for computing-intensive tasks, the UI will still freeze though sleep is used. jShell runs a different process and using wait for with it is okay.
Sub S1
'update UI
wait fo (S2) Complete (result as Object)
'update UI
End Sub
Sub S2 as ResumableSub
'do something
wait for (S3(param)) Complete (result as Object)
return value
End Sub
Sub S3(param as map) as ResumableSub
'S3 requires some time to process and will block the thread.
return value
End Sub