Return-Path: Delivered-To: apmail-apr-dev-archive@apr.apache.org Received: (qmail 5626 invoked by uid 500); 25 Jun 2001 17:10:27 -0000 Mailing-List: contact dev-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Delivered-To: mailing list dev@apr.apache.org Received: (qmail 3840 invoked from network); 25 Jun 2001 17:06:57 -0000 Date: Mon, 25 Jun 2001 10:06:31 -0700 From: Aaron Bannert To: Jeff Trawick Cc: dev@apr.apache.org Subject: Re: apr_lock.h lock scope question Message-ID: <20010625100631.F10809@ebuilt.com> References: <20010622073711.K5701@ebuilt.com> <20010622082701.L5701@ebuilt.com> <20010625093544.C10809@ebuilt.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: ; from trawick@attglobal.net on Mon, Jun 25, 2001 at 12:37:24PM -0400 X-AntiVirus: scanned for viruses by AMaViS 0.2.1-pre3 (http://amavis.org/) X-Spam-Rating: h31.sny.collab.net 1.6.2 0/1000/N > What this means is that to block out *all* other processes and > threads, unless we're on a system where APR_PROCESS_LOCK_IS_GLOBAL is > defined, we need to get an interprocess lock (to block out everything > but threads in our own process) as well as a intraprocess lock (to > block out other threads in our own process). Fine, so interprocess locks conditionally depend on intraprocess locks, but not vice versa. So let's take all this extra overhead out of calls that could be for simple intraprocess mutexes. > If we use a kernel mechanism for interprocess locking which doesn't > block out other threads in the same process then this certainly can > happen. > > Generally, APR does use such a kernel mechanism on Unix. Right, but this happens at a much lower level than "acquire a cross-process lock on any platform". I think it would be best to provide a two-layered lock subsystem: - The high layer would provide real simple, general, and cross-platform calls for functionality like "give me my fastest mutex impl", or "acquire a cross-process lock on any platform". - This high layer would depend on the lower layer. - The lower layer would introduce the implementation-by-function-pointer concept you proposed this morning. It would provide more-platform-specific calls that would allow runtime flexibility/optimization when choosing an implementation for some locking feature. It is fine if these layers are really just hidden function pointers, but I would prefer if they were well-defined at the higher-layer. -aaron