Remember that that a call to Sleep or Wait For in a resumable sub causes the code flow to return to the parent. Example: Sub Button1_Click Sum(1, 2) Log("after sum") End Sub Sub Sum(a As Int, b As Int) Sleep(100) 'this will cause the code flow to return to the parent Log(a + b) End Sub...
New video tutorial: Resumable subs is a new feature added in B4J v5.50 / B4i v4.00 / B4A v7.00. It dramatically simplifies the handling of asynchronous tasks. (This feature is a variant of stackless coroutines.) The special feature of resumable subs is that they can be paused, without...
A pattern such as this one can be used when you want to run multiple resumable subs concurrently and wait for all of them to complete before continuing: Dim status(1) As Int Test1(status) Test2(status) Test3(status) Do While status(0) < 3 Sleep(50) Loop...
A pattern such as this one can be used when you want to run multiple resumable subs concurrently and wait for all of them to complete before continuing: Dim status(1) As Int Test1(status) Test2(status) Test3(status) Do While status(0) < 3 Sleep(50) Loop...