How to know the task xTaskHandle?

nobody wrote on Wednesday, November 22, 2006:

I want to suspend a task with vTaskSuspend, and call vTaskResumeFromISR to resume it from an interrupt.
To call vTaskSuspend and vTaskResumeFromISR I think I need to know the xTaskHandle. If I am wrong please explain…

Here is what I want do do:

static xTaskHandle xHandle;

void DoSomething (void)
{
     // Get resource semaphore with xSemaphoreTake

     // I must get the xHandle from current task here…

     // Use the xHandle to suspend the created task.
     vTaskSuspend( xHandle );
    
     // Release resource semaphore with xSemaphoreGive
}

void vAnExampleISR( void )
{
  portBASE_TYPE xYieldRequired;

  // Resume the suspended task.
  xYieldRequired = xTaskResumeFromISR( xHandle );

  if( xYieldRequired == pdTRUE )
  {
         portYIELD_FROM_ISR();
  }
}