On 2010-02-27 at 23:07:57 [+0100], Ryan Leavengood <leavengood@xxxxxxxxx> wrote: > On Sat, Feb 27, 2010 at 3:47 PM, <webkit@xxxxxxxxxxxxxxx> wrote: > > Author: stippi > > Date: Sat Feb 27 20:47:03 2010 > > New Revision: 241 > > URL: http://mmlr.dyndns.org/changeset/241 > > > > Log: > > Rewrote the SharedTimer impelementation. The old one used BMessageRunner, > > which > > is imprecise since it uses the registrar to fire messages across > > processes. This > > uses kernel ports and has bad timing resolution. The new message uses > > it's own > > high priority thread. The BMessageFilter is now a BHandler, which doesn't > > change much, other than how the message arrives. But sending messages > > within > > the same team attaches the message directly to the message queue, no ports > > involved. The asteroids demo stays totally smooth now. :-) > > For what it's worth, my original SharedTimerHaiku was much like this > one (though I'm sure yours is better), but for some reason Andrea > Anzani rewrote it as a BMessageRunner. I recall some discussion over > that, but I just find it funny how it has reverted back somewhat. > > If you care: > > http://ryanleavengood.com/haiku/SharedTimerHaiku.cpp > > Good to see I wasn't wrong on everything :) One problem with your solution, is that it runs the timer function in the wrong thread. I haven't looked closely enough if that was the only problem, or if there was another reason why Andrea rewrote it. That I am using a different thread as well is just for improved precision. Otherwise it's equivalent to the BMessageRunner version. Best regards, -Stephan