[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Fine grained management of timers.

snacktime

11/3/2007 7:44:00 AM

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

1 Answer

Jano Svitok

11/3/2007 10:55:00 AM

0

On 11/3/07, snacktime <snacktime@gmail.com> wrote:
> 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

http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-t...