It yields the same result from the point og view of your program, but it does not consume 100% CPU.
To achieve what you want you'll need to redesign your code, to not depend on sleeping, as already said.
There are several ways to do what you want. One way would keep track of the time that has passed and then only call the delayed function when enough time has elapsed, then reset the time counter.