Re: Re-entrancy???

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance




"Karl E. Peterson" <karl@xxxxxxxx> wrote in message news:etF9DRLYJHA.1328@xxxxxxxxxxxxxxxxxxxxxxx
Bill McCarthy wrote:
If Do Events didn't yield then obviously the loop
would make the entire system unresponsive whilst it was running.

That's patently false, because Windows will still be slicing off time slots, and there's no way any VB program can prevent that.
--

Nope, you're wrong here too. Perhaps if you took the time to research these things before going on a flame rampage you'd see that. I see you've already been corrected about DoEvents calling Sleep(0). Pity you posted half a dozen "attacks" prior to that especially as this has already been covered in this thread.

As to the above, it's a demonstrable and measurable effect. Create an application that has two loops, one that calls DoEvents in it the other not. Then run another app that runs a lengthy process. If you run the first app without the DoEvents, the second app will take longer to complete on a single processor machine, then if you run the first app with DoEvents. This measurable time difference is the period the system is "unresponsive" because your app is not yielding to the OS.

See also the documentation on MSDN for the Sleep function, where it clearly says:
"A value of zero causes the thread to relinquish the remainder of its time slice to any other thread of equal priority that is ready to run. "

.



Relevant Pages

  • Re: Virus alert on my app??
    ... waste of battery energy if your app is merely polling something in a loop ... processor after it has offered it up until at least one time slot period has ... DoEvents does actually call Sleepbut either of them in a closed loop ...
    (microsoft.public.vb.general.discussion)
  • Re: Debuggen beendet nicht, Prozess bleibt erhalten
    ... Wenn Die App startet, _ohne_ .DoEvents dann werden keine Grid ... string cSelect1 = ... Normal beenden sich die Tray-Apps natürlich richtig. ...
    (microsoft.public.de.german.entwickler.dotnet.csharp)
  • Re: CPU Maxxed
    ... The files I parse are about 20 megs in size. ... >counter to see how often to call DoEvents and see how it goes. ... That sounds to me as if your App is doing /very/ heavy Disk I/O ... Mostly Windows taskshares quite nicely, but if an App is deep in the ...
    (microsoft.public.vb.general.discussion)
  • Re: doevents
    ... trickier than just using DoEvents and also involves writing more code, ... local or remote database while a user continues to work with your app. ... Device Application Development MVP ... Ginny Caughey wrote: ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: Can I use threading to launch a form with progress bar and upd
    ... will actually be a total of 3 windows forms display. ... DoEvents is an ugly hack. ... app is visibly sluggish. ... You then open a progress window with a Cancel button on it, ...
    (microsoft.public.dotnet.languages.csharp)