Interrupt and task synchronization problems

Hi everyone, I have a question:
When ZYNQ7035 is used, the ps OS uses FreeRTOS. There are two tasks, task1 and task2, and task1 has a high priority. When a hardware interrupt comes, it enters the interrupt_handler function, releases the semaphore g_SemRecvDone in the interrupt handler function, and in task task1 it blocks waiting for the semaphore to arrive. There is a 5-10ms delay from the release of the interrupt to the reception of the task. Why? What’s the solution?

int interrupt_handler(void) 
{
	i++;
	...
	xSemaphoreGiveFromISR(g_SemRecvDone, &lRet);
	XTime_GetTime(&tCur1);
	return 0;
}

void task1(void)
{
	...
	uiTimeoutMs = 0xffffffffUL;
	while(1)
	{
		if(pdFAIL == xSemaphoreTake(g_SemRecvDone, uiTimeoutMs))
		{
		
		}
		 XTime_GetTime(&tCur2);
		 tUsed = ((tCur2 - tCur1) * 1000000) / (COUNTS_PER_SECOND);
	}

}
void task2(void)
{
	...

	while(1)
	{
		....
	}

}

… I think making use of lRet.
See the example code here This page describes the xSemaphoreGiveFromISR() FreeRTOS API function which is part of the RTOS interrupt safe semaphore API source code function set. FreeRTOS is a professional grade open source RTOS for microcontrollers.

you may also want to look into task notifications.