No, using SIGEV_THREAD will create one worker thread per timer created.

Posix doesn't specify this level of implementation detail. In Bionic, we
want to keep things simple
and using one thread per timer achieves that.

At the opposite spectrum, you'll find GLibc which uses some very
sophisticated heuristics to
determine if several timers can be handled by the same worker thread (this
depends on the exact
parameters used when creating the timer). This uses less threads in the
general case but makes
the implementation a lot more complex.

(On the other hand, it means that if one of your timer callbacks does
something stupid, like blocking
on i/o for a long time, then no other timers events will be generated).

My position on this is that if you need to handle a *lot* of timer, simply
create your own sorted queue
of your own "timer" objects, and create a single Posix real-time timer to
handle the first timeout in
the queue, update the queue after the corresponding callback is called,
reprogram the timer period,
rinse repeat, etc...

In all cases, with a lot of timers, it will be more efficient than using
Posix real-time timers, even
with GLibc.

On Wed, Feb 18, 2009 at 4:09 AM, Girish <[email protected]> wrote:

>
> Hi One more Q for you
>
> > Yes, it is, but frankly you should be using a single SIGEV_THREAD timer
> with
> > your own sorted timer list
>
> Do that means SIGEV_THREAD functionality will put the timers in one
> event list and sort them all together ? and timeouts will happen
> similar to POSIX signals ? or user has to sort them in order ?
>
> Regards
> Girish
>
> On Feb 12, 6:39 pm, David Turner <[email protected]> wrote:
> > Yes, it is, but frankly you should be using a single SIGEV_THREAD timer
> with
> > your own sorted timer list
> >
> > On Thu, Feb 12, 2009 at 2:14 PM, Girish <[email protected]> wrote:
> >
> > > Hi,
> >
> > > Is SIGEV_THREAD is part of open source and cupcake code now ? With
> > > SIGEV_THREAD also i guess we should be able to create 32 timers per-
> > > process right ?  Can any one point me out using threads over signals
> > > for timer operation.
> >
> > > Regards
> > > Girish
> >
> >
> >
>

--~--~---------~--~----~------------~-------~--~----~
unsubscribe: [email protected]
website: http://groups.google.com/group/android-porting
-~----------~----~----~----~------~----~------~--~---

Reply via email to