L leitor79 Active Member Licensed User Longtime User Aug 21, 2017 #1 Hello! I've just received the 7.30 update and I've read the changelog and this post, and I still don't get the ResumableSub type advantage/need... I mean, I see the different syntax, but I don't understand what could be achieved with a ResumableSub that couldn't be done without it. I've read comments about lot of ideas or uses, but I don't see the difference between this: Code: Copy Sub Button1_Click Wait For(Sum(1, 2)) Complete (Result As Int) Log("result: " & Result) Log("after sum") End Sub and this Code: Copy Sub Button1_Click Dim rs As ResumableSub = Sum(1, 2) Wait For(rs) Complete (Result As Int) Log("result: " & Result) Log("after sum") End Sub Can anyone give me a tip? Thank you very much!
Hello! I've just received the 7.30 update and I've read the changelog and this post, and I still don't get the ResumableSub type advantage/need... I mean, I see the different syntax, but I don't understand what could be achieved with a ResumableSub that couldn't be done without it. I've read comments about lot of ideas or uses, but I don't see the difference between this: Code: Copy Sub Button1_Click Wait For(Sum(1, 2)) Complete (Result As Int) Log("result: " & Result) Log("after sum") End Sub and this Code: Copy Sub Button1_Click Dim rs As ResumableSub = Sum(1, 2) Wait For(rs) Complete (Result As Int) Log("result: " & Result) Log("after sum") End Sub Can anyone give me a tip? Thank you very much!
Erel B4X founder Staff member Licensed User Longtime User Aug 21, 2017 #2 I'm sorry but I previously thought that you are asking about resumable subs in general. There is no difference between the two code snippets you posted. Both rely on the new ResumableSub type. The first one gets the ResumableSub object and passes it immediately to Wait For while the second uses a variable to hold the ResumableSub feature. It was not possible to wait for a resumable sub like this in the previous version. Upvote 0
I'm sorry but I previously thought that you are asking about resumable subs in general. There is no difference between the two code snippets you posted. Both rely on the new ResumableSub type. The first one gets the ResumableSub object and passes it immediately to Wait For while the second uses a variable to hold the ResumableSub feature. It was not possible to wait for a resumable sub like this in the previous version.
L leitor79 Active Member Licensed User Longtime User Aug 21, 2017 #3 Hi Erel, thank you very much for your answer. Can something be done with the ResumableSub type, besides using it to hold the resumablesub feature? Thank you! Upvote 0
Hi Erel, thank you very much for your answer. Can something be done with the ResumableSub type, besides using it to hold the resumablesub feature? Thank you!
Erel B4X founder Staff member Licensed User Longtime User Aug 22, 2017 #4 It has a Complete property which you can use to check whether the resumable sub has completed or not. You can use it to implement a timeout mechanism. Upvote 0
It has a Complete property which you can use to check whether the resumable sub has completed or not. You can use it to implement a timeout mechanism.