Wish Wait for Timeout

Lello1964

Well-Known Member
Licensed User
Longtime User
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
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
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.
 
Top