I have a simple console app which does Console.WriteLine. The problem is that when I execute the program, it is not writing some of the texts to the console. (Timer #1 : 10 seconds is missing i.e.)
And it happens if I increase the i on:
for (int i = 0; i < 100000; i++)
{
    Console.WriteLine(mainThread.Name);
}
If I set i to 1000 or something smaller it writes all to the console.
Here is my code.
using FightClub.MultiThreading;
Thread mainThread = Thread.CurrentThread;
mainThread.Name = "Main Thread";
Thread thread1 = new Thread(() => CountUp());
Thread thread2 = new Thread(() => CountDown());
thread1.Start();
thread2.Start();
for (int i = 0; i < 100000; i++)
{
     Console.WriteLine(mainThread.Name);
}
static void CountDown()
{
    for (int i = 10; i >= 0; i--)
    {
        Console.WriteLine("Timer #1 : " + i + " seconds");
        Thread.Sleep(1000);
    }
    Console.WriteLine("Timer #1 is complete!");
}
static void CountUp()
{
    for (int i = 0; i <= 10; i++)
    {
        Console.WriteLine("Timer #2 : " + i + " seconds");
        Thread.Sleep(1000);
    }
    Console.WriteLine("Timer #2 is complete!");
}
I have tried setting the thread priorities to high but nothing changed.
 
     
    