AnsweredAssumed Answered

Switching between thread on RTOS ?

Question asked by H.Rick on Mar 29, 2017
Latest reply on Apr 3, 2017 by H.Rick

Everybody,

I want to switch between thread on RTOS, how can I do that ?

I've written down below, but it seems that it's staying on the first thread only,

Thanks

 

/* StartDefaultTask function */


void StartDefaultTask(void const * argument)

 

{


  /* init code for FATFS */

 

  MX_FATFS_Init();

 

  /* init code for USB_DEVICE */
  MX_USB_DEVICE_Init();

 

  /* USER CODE BEGIN StartDefaultTask */
  /* Infinite loop */
    test_fatfs();
    reading_file_test();
     /* Suspend Thread 1 */
    osThreadSuspend(NULL);
       /* Resume Thread 2*/
    osThreadResume(secondTaskHandle);
    
    /*
  for(;;)
  {
    osDelay(1);
  }
    */
  /* USER CODE END StartDefaultTask */
}

 

void StartSecondTask(void const * argument)
{
    reading_file_test();
     /* Resume Thread 1 */
    osThreadResume(defaultTaskHandle);

 

    /* Suspend Thread 2 */
    osThreadSuspend(NULL);
}

Outcomes