Please try using CyU3PThreadRelinquish API instead ThreadSleep.
Relinquish control to the OS scheduler.
This is a RTOS call for fair scheduling which relinquishes control to other ready threads that are at the same priority
level. The thread that relinquishes control remains in ready state and can regain control if there are no other ready
threads with the same priority level.