Wish Wait for... a block of code, like a sub, to finish.

Cableguy

Expert
Licensed User
Longtime User
I'm posting this wish here as at the moment is were I do most of my development, but I guess this is a B4X wish.

The newly introduced Wait For system is amazing and allows for very inteligente short-circuits, but it has, at present, one major flaw.
You cannot wait for a block of code to complete..
I know we can use callsubdelayed for that, but it does not have the same flexibility as the wait for would have.
Imagine this pseudo-code

B4X:
Private Sub AnySubWillDo
wait for SecondSub(result)
'code continues only after SecondSub finishes
EndSub

Private Sub SecondSub as Boolean
task#1
task#2
....
Task#n
Return True
End Sub

At present, without a (hard to maintain) complex Sub calling thecnique, this is not doable...
(or is it???)
 

Cableguy

Expert
Licensed User
Longtime User
just tried those "as resumable sub"... tricky to get it working, but once you get the hang of it....!!!
 
Top