Lello1964 Well-Known Member Licensed User Longtime User Dec 19, 2020 #1 It would be possible to add an optional timeout to the Wait for eventName function that closes the wait automatically after Timeout msec. example : Wait for myEvent (itsOk As Boolean) (Timeout = 10000, EventTimeout as Boolean) it Timeout is declared after 10000 ms return EventTimeout = True
It would be possible to add an optional timeout to the Wait for eventName function that closes the wait automatically after Timeout msec. example : Wait for myEvent (itsOk As Boolean) (Timeout = 10000, EventTimeout as Boolean) it Timeout is declared after 10000 ms return EventTimeout = True
Erel B4X founder Staff member Licensed User Longtime User Dec 19, 2020 #2 It is not so useful as you can't cancel generic tasks, so the task will continue to run and the program state will be more complicated. The timeout should be implemented in the task itself. This is already implemented in network calls, http requests and many other places where it makes sense. It is possible to implement a timeout with Wait For. Example (it can be simplified as it was written before the "return ResumableSub" feature was available): https://www.b4x.com/android/forum/threads/need-help-with-waitfor-solved.105512/post-660853
It is not so useful as you can't cancel generic tasks, so the task will continue to run and the program state will be more complicated. The timeout should be implemented in the task itself. This is already implemented in network calls, http requests and many other places where it makes sense. It is possible to implement a timeout with Wait For. Example (it can be simplified as it was written before the "return ResumableSub" feature was available): https://www.b4x.com/android/forum/threads/need-help-with-waitfor-solved.105512/post-660853
Lello1964 Well-Known Member Licensed User Longtime User Dec 19, 2020 #3 I've seen the example, but it's very intricate to make. It would be useful to have a timeout directly in the wait, when necessary, which closes the wait and continues with the execution of the next line.
I've seen the example, but it's very intricate to make. It would be useful to have a timeout directly in the wait, when necessary, which closes the wait and continues with the execution of the next line.
AnandGupta Expert Licensed User Longtime User Dec 19, 2020 #4 Lello1964 said: which closes the wait and continues with the execution of the next line. Click to expand... But Erel said: so the task will continue to run and the program state will be more complicated Click to expand... Regards Anand
Lello1964 said: which closes the wait and continues with the execution of the next line. Click to expand... But Erel said: so the task will continue to run and the program state will be more complicated Click to expand... Regards Anand
LucaMs Expert Licensed User Longtime User Dec 19, 2020 #5 https://www.b4x.com/android/forum/threads/b4x-waitforwithtimeout-timeouthandler.110703/post-690845