From owner-freebsd-smp@FreeBSD.ORG Fri Apr 4 11:52:23 2003 Return-Path: Delivered-To: freebsd-smp@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8612C37B401 for ; Fri, 4 Apr 2003 11:52:23 -0800 (PST) Received: from relay.pair.com (relay.pair.com [209.68.1.20]) by mx1.FreeBSD.org (Postfix) with SMTP id 5DE5043F75 for ; Fri, 4 Apr 2003 11:52:22 -0800 (PST) (envelope-from rooneg@electricjellyfish.net) Received: (qmail 33673 invoked from network); 4 Apr 2003 19:52:21 -0000 Received: from softdnserror (HELO electricjellyfish.net) (64.246.81.227) by relay.pair.com with SMTP; 4 Apr 2003 19:52:21 -0000 X-pair-Authenticated: 64.246.81.227 Message-ID: <3E8DE275.6040000@electricjellyfish.net> Date: Fri, 04 Apr 2003 14:52:21 -0500 From: Garrett Rooney User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.3b) Gecko/20030130 X-Accept-Language: en-us, en MIME-Version: 1.0 To: John Baldwin References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit cc: freebsd-smp@FreeBSD.org Subject: Re: atomic_dec_and_test() in FreeBSD? X-BeenThere: freebsd-smp@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: FreeBSD SMP implementation group List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Apr 2003 19:52:23 -0000 John Baldwin wrote: >>I believe Craig is looking for a user space solution, not kernel space. >> >> > >Argh, I couldn't remember. Well, one could always use a mutex to >protect the count I suppose. One must be using some sort of threads >library for this to even make sense in userland. > yeah, the default implementation of this function in APR uses mutexes to ensure that the increment is atomic, but craig is looking for a way to implement the 'platform specific faster way to do it without a mutex'. worst case, we can just use the default impl on freebsd 4.x and use atomic_cmpset_int on 5.x. -garrett