0

I have a simple c# console application that calls a function in which contains a continuous for(;;) loop, the problem is that when this function is called, any code after from where the function is called doesn't execute until the function that is running the infinite for(;;) stops execution. Heres an example:

static void Main(string[] args)
{
    ExampleFunc();
    Console.Writeline("This doesn't show up :(");
}

static void ExampleFunc()
{
    for(;;)
    {
        //Blah Blah Blah
    }
}

Does anyone have any solutions?

Thank you for your time.

C0d1ng
  • 441
  • 6
  • 17
  • 1
    https://msdn.microsoft.com/en-us/library/aa645740(v=vs.71).aspx Also http://stackoverflow.com/questions/363377/how-do-i-run-a-simple-bit-of-code-in-a-new-thread – Idos May 15 '16 at 06:31

2 Answers2

0

I am not able to see comment so I ll put it as answer. Are you sure that the control isnt in infinite loop? And also after for loop try to put Console.Write() and attach debugger then try to follow the control!! It must go back to the main method as it contains the return stack method(entry and exit to the program ) .

Hameed Syed
  • 3,939
  • 2
  • 21
  • 31
-1

Because u run program with one thread simply run your func in another thread and it won't stop your other code