switch task function should be independent calling function. And should be isolated from timer interrupt