On Sat, Mar 15, 2008 at 4:06 AM, Kouhei Sutou <kou / cozmixng.org> wrote:
>> I'm writing a Ruby GTK application that runs on a mobile device (Nokia N800).
>> It's starting to take shape now, but I have noticed that leaving it running for
>> long periods of time is particularly bad for my battery life.
>>
>> I don't really understand Ruby threads under the hood or what alterations to
>> them ruby-gtk2 makes (but am keen to learn!). Powertop suggests that Ruby is
>> waking up around 100 times a second when there is an active thread, even
>> during a sleep state. Presumably this is to check for thread activity.
>
> This should be fixed in Ruby-GNOME2 trunk.

Hi all,

Can you share some more details on how exactly it was addressed? I
have a multi-threaded Ruby daemon that has nothing to do with Gtk, and
it exhibits the same behaviour: 100 calls to do_nanosleep per second.
The deamon is a DRb based object cache, the whole source is these two
files, 191 lines total:

http://cvs.savannah.gnu.org/viewvc/*checkout*/samizdat/samizdat/lib/samizdat/cache.rb?revision=1.99
http://cvs.savannah.gnu.org/viewvc/*checkout*/samizdat/samizdat/bin/samizdat-drb-server?revision=1.99

This definitely looks like a generic Ruby issue to me, but if there is
a workaround, I don't mind applying it on the application level.

[ sorry for waking up this really old thread, but Google tells me that
is the only case where Ruby do_nanosleep issue was addressed ]

-- 
Dmitry Borodaenko