Save up to 50% in our Spring Sale!
Save up to 50% off any of our desktop apps in our Spring Sale, including DisplayFusion,
ClipboardFusion, FileSeek, iTunesFusion, LogFusion, TrayStatus, and VoiceBot!

Title

Message

Confirm

Want to earn a free VoiceBot Pro license? We're looking for VoiceBot translators!
<< DiscussionsReply

CPU friendly infinite loop

Avatar from Gravatar.com
DAB42
31 discussion posts
I am currently using a while(true) { } too keep my elite journal reader program active but would like to make it less cpu intensive. any help or ideas would be greatly appreciated.

A Small delay of 1ms does improve CPU usage dramatically but some events are missed during the wait time.

Code

Nov 30, 2018 (modified Dec 1, 2018)  • #1
Keith Lammers (BFS)'s profile on WallpaperFusion.com
The only way really would be to use thread sleeps, like you did. If you try BFS.General.ThreadWait(1) instead, does that work better?
Dec 4, 2018  • #2
Avatar from Gravatar.com
DAB42
31 discussion posts
Thank you Keith

Did try threadwait but that seemed to slow the entire script and the watchers did not work.

the cpu usage has improved greatly using delay dropping form 13 percent to less then 3 so happy with the improvement
Dec 4, 2018  • #3
Keith Lammers (BFS)'s profile on WallpaperFusion.com
Ok, sounds good!
Dec 4, 2018  • #4
Was this helpful?  Login to Vote  Login to Vote
<< DiscussionsReply