This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

RTOS Signalling

Hello,
i m playing with rtos , and i write this code ;

void Thread (void const *argument) {

  while (1) {
                osSignalClear(tid_Thread_Blink2,1);
                GPIO_PinWrite (GPIOB,5,1);
    osDelay (2000);
                GPIO_PinWrite (GPIOB,5,0);
                osSignalSet (tid_Thread_Blink2,1);
    osDelay (3000);
    osThreadYield();                                            // suspend thread
  }
}

void Thread2 (void const *argument) {
        osEvent ThEvent;

  while (1) {
                ThEvent = osSignalWait (1,osWaitForever);
                if( ThEvent.status == osEventSignal){
                        osSignalSet (tid_Thread_Blink2,ThEvent.value.signals);
                }
                GPIO_PinWrite (GPIOB,5,0);
    osDelay (100);
                GPIO_PinWrite (GPIOB,5,1);
    osDelay (100);
    osThreadYield();                                            // suspend thread
  }
}

my aim is Thread2 should run after signaled in the thread1, and it should run until the signal cleared by thread1.
Code is working how i want, but is this the correct way for what i want?
Also osSignalWait function clearing signal flag automatically, so is there any option to disable auto clearing?

Best regards