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

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -