Hi,
Please could you explain why using a ResumableSub from AppStart seems to hold the whole process ? I am sure I am doing something wrong but can't find why. Thanks
While
Please could you explain why using a ResumableSub from AppStart seems to hold the whole process ? I am sure I am doing something wrong but can't find why. Thanks
Hello world!!!
enters test1
enters subtest1
enters subsubtest1
enters test2
exits subsubtest1
exits test2
exits subtest1
exits test1
B4X:
Sub AppStart (Args() As String)
pl(0,"Hello world!!!")
test1
test2
' Wait For (test2) Complete(result As String)
StartMessageLoop
End Sub
Sub test1 As ResumableSub
pl(1,"test1")
Wait For (subtest1) Complete(result As String)
Sleep(0)
pl(2,"test1")
Return Null
End Sub
Sub subtest1 As ResumableSub
pl(1,"subtest1")
Wait For(subsubtest1) Complete(result As String)
pl(2,"subtest1")
Return Null
End Sub
Sub test2 As ResumableSub
pl(1,"test2")
Sleep(0)
pl(2,"test2")
Return Null
End Sub
Sub subsubtest1 As ResumableSub
pl(1,"subsubtest1")
Sleep(0)
pl(2,"subsubtest1")
Return Null
End Sub
Sub pl(rank As Int,what As String)
Dim output As String
Select rank
Case 1
output="enters "
Case 2
output="exits "
End Select
Log($"${output}${what}"$)
End Sub
While
Hello world!!!
enters test1
enters subtest1
enters subsubtest1
enters test2
B4X:
Sub AppStart (Args() As String)
pl(0,"Hello world!!!")
test1
' test2
Wait For (test2) Complete(result As String)
StartMessageLoop
End Sub
Sub test1 As ResumableSub
pl(1,"test1")
Wait For (subtest1) Complete(result As String)
Sleep(0)
pl(2,"test1")
Return Null
End Sub
Sub subtest1 As ResumableSub
pl(1,"subtest1")
Wait For(subsubtest1) Complete(result As String)
pl(2,"subtest1")
Return Null
End Sub
Sub test2 As ResumableSub
pl(1,"test2")
Sleep(0)
pl(2,"test2")
Return Null
End Sub
Sub subsubtest1 As ResumableSub
pl(1,"subsubtest1")
Sleep(0)
pl(2,"subsubtest1")
Return Null
End Sub
Sub pl(rank As Int,what As String)
Dim output As String
Select rank
Case 1
output="enters "
Case 2
output="exits "
End Select
Log($"${output}${what}"$)
End Sub