Hacker News new | ask | show | jobs
by asveikau 2714 days ago
I agree and came here to comment that you should not use this code.

The code has sleep calls and polls the filesystem. The nonportable OS support will actually block and have the kernel wake you up when there are actual changes - and not wake you when there is no change - much kinder on the CPU!

Just say no indeed, to polling the filesystem with sleep calls. (Maybe as a last resort if the OS specific support is unavailable?)