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

Manfred Spraul (manfred@colorfullife.com)
Mon, 26 Mar 2001 19:12:55 +0200


From: "Stelian Pop" <stelian.pop@fr.alcove.com>
> >
> > 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.

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

--
    Manfred

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