I am trying to run 3 levels of timers at the same time in a C# application for example:
T1 will run in the beginning of the application, then on its Tick event, T2 will start and then on the tick event of T2, T3 will start. Finally, on the tick event of T3, something should be done in the main thread of the application
My problem seems to be that the code in the main thread is not working when it is being called by an other thread
What should I do to let the main thread run its functions by a call from other threads?
Most probably the problem is that your main thread requires invocation. If you would run your program in debugger, you should see the Cross-thread operation exception, but at run time this exception check is disabled.
If your main thread is a form, you can handle it with this short code:
or .NET 2.0
EDIT: for console application you can try following: