__hal_lock(__handle__)

this is the code snippet

#if (USE_RTOS == 1U)
/* Reserved for future use */
#error “USE_RTOS should be 0 in the current HAL release”
#else
#define __HAL_LOCK(HANDLE)
do{
if((HANDLE)->Lock == HAL_LOCKED)
{
return HAL_BUSY;
}
else
{
(HANDLE)->Lock = HAL_LOCKED;
}
}while (0U)

#define __HAL_UNLOCK(HANDLE)
do{
(HANDLE)->Lock = HAL_UNLOCKED;
}while (0U)
#endif /* USE_RTOS */

if I define USE_RTOS = 1 then code does not build. So do i have to replace __HAL_LOCK() and __HAL_UNLOCK() with semaphore or mutex in all hal libraries to use freertos properly.