I need to test some communication libraries and need to keep the server busy so that I can test timeouts, but I am unable to use sleep()
as it causes problems during testing.
Is there a common algorithm I can use to keep a process busy? I'm not concerned with running the CPU hot, simply keeping the process from returning for a number of seconds without expending too many resources.
If I could define the time to keep the process busy for, that would be useful.