console app timer events - do loops need App.DoEvents?

Hello all.

I am working on a console app that polls devices on a serial port. In addition to the DoEvents in the Run Event

While StayAlive = True
  Doevents
wend

I am wondering if I need to add App.DoEvents when in a loose loop? I am pretty sure the answer is no, especially when I am using Timers as part of the app. Basically during the execution of a do loop within the app, I start certain timers. I want to be sure they will go off at roughly the time they should (usually 500mS intervals).

What say you?
Thanks,
Tim

in theory it shouldnt hurt to put that in loops esp if they are really busy tight and long running ones

Thanks Norman.
To ask another related question, the Timer events will fire even if inside this loop and without any execess DoEvents. Is that correct?

Tim

I believe thats true

Thank you again Norman.
That is my expectation as well, and it does appear to work that way too

Tim

We usually use DoEvents to have a main loop in console apps where we need a main loop.
e.g. for sockets and timers.

Another way to handle this is to put only the loop in the Run event and put your main code in a Thread. Timers can be set up in either.

Tim - keep in mind that there’s what “Should” work and then there’s Linux and what DOES work.

Linux loops can be so tight that a console app will not update the stdout stream until the end of the loop or app exit without calling App.DoEvents(5). If you are expecting ANY I/O in that while loop on Linux, you really do want to add the App.DoEvents().