Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Mon, 26 Mar 2001 12:14:03 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Mon, 26 Mar 2001 12:13:53 -0500 Received: from colorfullife.com ([216.156.138.34]:14345 "EHLO colorfullife.com") by vger.kernel.org with ESMTP id ; Mon, 26 Mar 2001 12:13:42 -0500 Message-ID: <007d01c0b618$040b1780$5517fea9@local> From: "Manfred Spraul" To: "Stelian Pop" Cc: In-Reply-To: <000d01c0b3c7$e232ae90$5517fea9@local> <20010326165425.G15689@come.alcove-fr> Subject: Re: Use semaphore for producer/consumer case... Date: Mon, 26 Mar 2001 19:12:55 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org From: "Stelian Pop" > > > > 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/