[haiku-development] Re: Timers in BLoopers

  • From: Stephan Assmus <superstippi@xxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Wed, 12 May 2010 13:47:32 +0200

On 2010-05-12 at 12:41:40 [+0200], Ingo Weinhold <ingo_weinhold@xxxxxx> 
wrote:
> On 2010-05-11 at 17:51:08 [+0200], Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
> wrote:
> > Ingo Weinhold <ingo_weinhold@xxxxxx> wrote:
> > > On 2010-05-11 at 16:35:58 [+0200], Stephan Assmus <superstippi@xxxxxx>
> > > > wrote:
> > > [...]
> > > > What do you guys think, does that sound like a good idea?
> > > After introducing wait_for_objects() I figured that it would be a
> > > useful
> > > addition to BLooper to also be able to handle other events than
> > > messages
> > > (FDs, semaphores, ports, threads, timers). While not that complicated
> > > to
> > > implement, it would still be a considerable extension of the API. I
> > > think
> > > it'd be better to wait until after R1.
> > 
> > Why not making the BMessageRunner a bit smarter, and use a local version
> > whenever possible? This would not require any API changes, would cause
> > less use of global resources, and would make those timers much more
> > precise and cheaper as well.
> > 
> > In other words (there is no "an" before "other", stippi, btw :-)), each
> > BLooper would get a time based event queue similar to what stippi
> > proposed (just with port_count(), instead of the BMessageQueue lock).
> 
> Sounds like a good solution.

I am not so sure. Who would send the messages locally? Wouldn't that also 
be another thread? I find it much more elegant (because cheaper and even 
more precise) to read from the port with a timeout and process timers when 
it timed out.

Best regards,
-Stephan

Other related posts: