to be honest,I dont know much things about rtos.Only a few things so the code you shared is too complicated for me.