From owner-freebsd-threads@FreeBSD.ORG Wed Apr 28 14:11:09 2010 Return-Path: Delivered-To: freebsd-threads@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 79651106564A for ; Wed, 28 Apr 2010 14:11:09 +0000 (UTC) (envelope-from bright@elvis.mu.org) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.freebsd.org (Postfix) with ESMTP id 6889E8FC13 for ; Wed, 28 Apr 2010 14:11:09 +0000 (UTC) Received: by elvis.mu.org (Postfix, from userid 1192) id 4BDB11A3D3B; Wed, 28 Apr 2010 07:11:09 -0700 (PDT) Date: Wed, 28 Apr 2010 07:11:09 -0700 From: Alfred Perlstein To: Karl Pielorz Message-ID: <20100428141109.GL35381@elvis.mu.org> References: <6AD0A971B01FA1DE632BAF65@HPQuadro64.dmpriest.net.uk> <20100428111226.GK35381@elvis.mu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i Cc: freebsd-threads@FreeBSD.org Subject: Re: Advice / best practice - thread connection pools / mutexes X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Apr 2010 14:11:09 -0000 * Karl Pielorz [100428 04:56] wrote: > > --On 28 April 2010 04:12 -0700 Alfred Perlstein wrote: > > >The most simple method is to do the following at startup: > > > >[snip wonderful sample code] > > > >This should provide for a connection pool, each thread > >can then call get_con() to get a connection, and should > >call put_con() when done with it. > > > >good luck. > >-Alfred > > Thanks, that looks pretty much exactly what I'm looking for - thanks also > to the other people who replied, I've certainly got a few options now > (which is a big improvement on what I had before!). I'd keep an eye out for Kip's version, it's likely to be a lot faster. :) -- - Alfred Perlstein .- AMA, VMOA #5191, 03 vmax, 92 gs500, 85 ch250, 07 zx10 .- FreeBSD committer