Re: POSIX clocks & timers - more choices

Andi Kleen (ak@suse.de)
Sun, 20 Oct 2002 05:49:25 +0200


On Sat, Oct 19, 2002 at 02:40:27AM -0400, Jim Houston wrote:
> > > +{
> > > + if (p->ary[bit] && p->ary[bit]->bitmap == (typeof(p->bitmap))-1)
> >
> > Without bitfield this would look much less weird.
> >
> > I would recommend using the bitops.h primitives for such stuff anyways.
>
> I will. This does look wierd, is this my code?

The typeof() cast looks weird. I had to think twice to make sense of it.

> Good point. It looks like find_task_by_pid() needs to be protected
> by a read_lock(&tasklist_lock). The timers are linked into
> a list so they will be removed when the process exits.
> Any sugestions on a code example that does this right are
> welcome:-)

/proc does it by increasing the count in the struct page of the stack
page of the process. exit() knows about that. Example is somewhere in fs/proc/
The increase has to be done inside the lock. As always one has to be careful
with lock ordering.

The standard way is to just hold the read lock of the tasklist.

-Andi
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/