From dev-return-19682-apmail-apr-dev-archive=apr.apache.org@apr.apache.org Fri Jan 11 18:38:02 2008 Return-Path: Delivered-To: apmail-apr-dev-archive@www.apache.org Received: (qmail 20754 invoked from network); 11 Jan 2008 18:38:02 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 11 Jan 2008 18:38:02 -0000 Received: (qmail 6209 invoked by uid 500); 11 Jan 2008 18:37:50 -0000 Delivered-To: apmail-apr-dev-archive@apr.apache.org Received: (qmail 6173 invoked by uid 500); 11 Jan 2008 18:37:50 -0000 Mailing-List: contact dev-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Id: Delivered-To: mailing list dev@apr.apache.org Delivered-To: moderator for dev@apr.apache.org Received: (qmail 24863 invoked by uid 99); 11 Jan 2008 15:51:07 -0000 X-ASF-Spam-Status: No, hits=1.0 required=10.0 tests=FB_WORD1_END_DOLLAR,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of luoyi.ly@gmail.com designates 66.249.92.173 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; bh=N68IVWCh8BK9NVXEolxSR1GU8wr3PPjW/tsSyX19nNg=; b=GQNDcSBLFvMNik9eDZj8KsNjN69RAONqKtucXF/MZ6kdzyezlIFxZY+x7MLC29NDWu976C7ghuucexfdNjpGTKwUba5Wlcb1rhrCqUOKyIbBDZQSzuoAbM6CD8VfTSNT9M/2YKLnM7F38mbq8/X4ePKcpeLHZiZa4/sDgAxLbv8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=XDitv/XwwSQXITpxF/pFdfvp3W5Y80DsKv/l8YUjwxlauI+xAOrnLSIuLMhkrwovQHUfUB4J7v8slkmQnyVajFv4gCl3N/5M/U2xhJ233LPKifXFJXe+wh4Z5Za5d5j6vvRZZK5ZFJse7CfHG2IgsI5U7P/MAJL2SPLBKEcDS70= Message-ID: Date: Fri, 11 Jan 2008 23:50:44 +0800 From: luoyi To: dev@apr.apache.org Subject: is SDBM threadsafe ? MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Checked: Checked by ClamAV on apache.org as far as I know, apr-util's sdbm is threadsafe ,but I've some demo code doesn't look right. the code: https://opensvn.csie.org/lylib/trunk/demo/apr/source/dbm_demo.c it create 10 thread, each insert 100 key-value pair to the dbm file. and then dbm_dump the file. my test script is: https://opensvn.csie.org/lylib/trunk/demo/apr/test.sh if the sdbm is threadsafe, the script will give me 10 lines of 100. but if I run it many times, then I can get some num other than 100: when it's right: luoyi@skyking apr$ ./test.sh 100 100 100 100 100 100 100 100 100 100 then run many times: luoyi@skyking apr$ for ii in `seq 0 20`; do ./test.sh |grep -v 100; done 59 108 68 80 90 105 112 115 113 101 62 71 79 92 106 113 115 114 27 24 194 19 17 16 17 19 193 191 27 24 194 19 17 16 17 19 193 191 my apr-version: luoyi@skyking apr$ apr-1-config --version 1.2.8 luoyi@skyking apr$ apu-1-config --version 1.2.8