I create a new thread. Here is a thread method code:
while (true)
{
if (!showHelp)
{
Console.Clear();
Console.WriteLine("==============================================");
Console.WriteLine(player.PlayList.CurrentTrack().Artist + " "
+ player.PlayList.CurrentTrack().Title + " "
+ player.PlayList.CurrentTrack().Genre.ToString());
Console.WriteLine(" [ " + pos.Duration() + " / "
+ player.PlayList.CurrentTrack().Length + " ] ");
Console.WriteLine("===============================================");
}
Thread.Sleep(1000);
if (isPlaying)
pos += TimeSpan.FromSeconds(1);
if (pos > player.PlayList.CurrentTrack().Length)
{
pos = TimeSpan.Zero;
player.Next();
}
}
I want to change current track position in the console. Every iteration I sleep for 1 sec and add 1 sec to position.
I do it in an infinite loop and my processor appears to be under a 50% load.
What should I do to reduce the load placed on my processor between iterations of the loop?