multithreading - How to start mutiple threads at the same time in C#? -


my project has 2 threads use system.timer

thread t1, t2; t1 = new thread(timer_product); t2 = new thread(timer_money); t1.start(); t2.start();  

when run application, starts t1, doesn't start t2.

if change order to

t2.start(); t1.start(); 

and run app again, t1 doesn't start, t2 starts.

the order of thread execution doesn't matter demonstrated below. suspect issue lies in timer_money or possibly timer_product.

examples:

void main() {     thread t1, t2;     t1 = new thread(t => { console.writeline("t1 running");});     t2 = new thread(t => { console.writeline("t2 running");});     t1.start();     t2.start();  } 

results:

t1 running
t2 running

now same threads reversed order of execution.

void main() {     thread t1, t2;     t1 = new thread(t => { console.writeline("t1 running");});     t2 = new thread(t => { console.writeline("t2 running");});     t2.start();      t1.start(); } 

results:

t2 running
t1 running


Comments

Popular posts from this blog

html - Difficulties with background-image property -

visual studio code - What does the isShellCommand property actually do and how should you use it? -

ios - Segue not passing data between ViewControllers -