User task switching hook function.