6 years, 7 months ago.

RTOS main thread is freeze in while loop.

I am using STM32 Nucleo L1 board for multithreading. Main thread is not printing continue "Hello Main". If i send '1' to pc.getc() than main thread execute one time and again wait for pc.getc(). how to i continue alive main thread. my code is like...

Thread thread1;
void hello(){
while(1){
              while(pc.getc() !='1'){                   // wait until receive 1 from Serial
                                      printf("Hello");
              }
              Thread::wait(500);
    }
}

main(){
    Thread thread1.start(hello());
    while(1){
                   printf("Hello main");
                   Thread::wait(1000);
   }
}
Be the first to answer this question.