We have a rails app that does async requests to backend data stores.
We send up to 10 of these requests for every http request, and 2-3 ms
matters.  I do have one thread that I spin up inside rails that wraps
a select() loop, and another loop that gets entered when a controller
is waiting for a response.  In that second loop I use a call to
sleep().  Sleep seems really unpredictable, probably because of it's
interaction with the thread timers via ruby's scheduler.  I've though
about using nanosleep via inline C, but even if that worked it would
probably block the thread causing worse problems.


So is this something that I just have to live with, or is there any
other way to get the equivalent of usleep/nanosleep?

Chris