RFC: env["async.sleep"] callback

Eric Wong normalperson at yhbt.net
Tue Dec 8 04:06:56 EST 2009


Eric Wong <normalperson at yhbt.net> wrote:
> For the concurrency models that appear synchronous, you can check out
> t/sleep.ru in the test cases for sleep examples:
> 
>   (case env['rainbows.model']
>   when :FiberPool, :FiberSpawn
>     Rainbows::Fiber
>   when :Revactor
>     Actor
>   else # :ThreadPool, :ThreadSpawn
>     Kernel
>   end).sleep(nr)
> 
> I may put that logic into a env["async.sleep"] callback in places where
> env["async.callback"] is not available so the synchronous-looking
> concurrency models can all share the same code.

Does anybody have any more thoughts (for or against) on this issue?

Most of the "sleepy" apps I've seen are actually unavoidably sleepy
because they're waiting on an external API call, and not just because
the app feels like sleeping...

-- 
Eric Wong


More information about the rainbows-talk mailing list