Re: Use semaphore for producer/consumer case...

Stelian Pop (stelian.pop@fr.alcove.com)
Tue, 27 Mar 2001 09:57:02 +0200


On Mon, Mar 26, 2001 at 07:12:55PM +0200, Manfred Spraul wrote:

> > > That doesn't work, at least the i386 semaphore implementation
> doesn't
> > > support semaphore counts < 0.
> >
> > Does that mean that kernel semaphore can not be used for something
> > else than mutual exclusion ?
> >
> It's a bit better: counts >= 0 are supported, i.e. you can call up()
> before down(), and that's used in several places.

I see... it's somewhat different than the classical semaphore
implementation, but usable anyway.

> The for loop that Nigel proposed should solve your problem. Multiple
> up's are handled correctly.

Now I understand his suggestion. Thanks to both of you.

Stelian.

-- 
Stelian Pop <stelian.pop@fr.alcove.com>
|------------- Ingénieur Informatique Libre --------------|
| Alcôve - http://www.alcove.com - Tel: +33 1 49 22 68 00 |
|----------- Alcôve, l'informatique est libre ------------|
-
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/