Re: [RFC] New locking primitive for 2.5

From: Denis Vlasenko (vda@port.imtp.ilyichevsk.odessa.ua)
Date: Fri Feb 08 2002 - 07:24:15 EST


On 7 February 2002 16:22, Christoph Hellwig wrote:
> In article <3C629F91.2869CB1F@dlr.de> you wrote:
> > The new lock uses a combination of a spinlock and a (mutex-)semaphore.
> > You can lock it for short-term issues in a spin-lock mode:
> >
> > combi_spin_lock(struct combilock *x)
> > combi_spin_unlock(struct combilock *x)
> >
> > and for longer lasting tasks in a sleeping mode by:
> >
> > combi_mutex_lock(struct combilock *x)
> > combi_mutex_unlock(struct combilock *x)
>
> I think this API is really ugly. If both pathes actually do the same,
> just with different defaults, one lock function with a flag would be
> much nicer. Also why do we need two unlock functions?
>
> What about the following instead:
>
> combi_lock(struct combilock *x, int spin);
> combi_unlock(struct combilock *x);

What is easier to read:
        combi_lock(zzzt_clock, 1);
        // go grepping .h to find out what this 1 means
or
        combi_spin_lock(zzzt_clock);
?

OTOH single unlock() looks good.

--
vda
-
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/



This archive was generated by hypermail 2b29 : Fri Feb 15 2002 - 21:00:16 EST