Implement thread-sleep to avoid busy-waiting

Remove system-dependent files