From commits-return-7702-apmail-apr-commits-archive=apr.apache.org@apr.apache.org Thu Apr 27 03:26:39 2006 Return-Path: Delivered-To: apmail-apr-commits-archive@www.apache.org Received: (qmail 6364 invoked from network); 27 Apr 2006 03:26:39 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 27 Apr 2006 03:26:39 -0000 Received: (qmail 15392 invoked by uid 500); 27 Apr 2006 03:26:39 -0000 Delivered-To: apmail-apr-commits-archive@apr.apache.org Received: (qmail 15296 invoked by uid 500); 27 Apr 2006 03:26:38 -0000 Mailing-List: contact commits-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: Reply-To: dev@apr.apache.org List-Id: Delivered-To: mailing list commits@apr.apache.org Received: (qmail 15281 invoked by uid 99); 27 Apr 2006 03:26:38 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 Apr 2006 20:26:38 -0700 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Wed, 26 Apr 2006 20:26:37 -0700 Received: (qmail 6275 invoked by uid 65534); 27 Apr 2006 03:26:17 -0000 Message-ID: <20060427032617.6273.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r397377 - /apr/apr-util/branches/1.2.x/dbd/apr_dbd_sqlite3.c Date: Thu, 27 Apr 2006 03:26:16 -0000 To: commits@apr.apache.org From: bojan@apache.org X-Mailer: svnmailer-1.0.8 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: bojan Date: Wed Apr 26 20:26:13 2006 New Revision: 397377 URL: http://svn.apache.org/viewcvs?rev=397377&view=rev Log: Rework commit 396309 from trunk to apply to 1.2.x (mutex lock code adjustment required to merge) Modified: apr/apr-util/branches/1.2.x/dbd/apr_dbd_sqlite3.c Modified: apr/apr-util/branches/1.2.x/dbd/apr_dbd_sqlite3.c URL: http://svn.apache.org/viewcvs/apr/apr-util/branches/1.2.x/dbd/apr_dbd_sqlite3.c?rev=397377&r1=397376&r2=397377&view=diff ============================================================================== --- apr/apr-util/branches/1.2.x/dbd/apr_dbd_sqlite3.c (original) +++ apr/apr-util/branches/1.2.x/dbd/apr_dbd_sqlite3.c Wed Apr 26 20:26:13 2006 @@ -245,12 +245,24 @@ apr_thread_mutex_lock(sql->mutex); do { + int retry_count = 0; + ret = sqlite3_prepare(sql->conn, query, length, &stmt, &tail); if (ret != SQLITE_OK) { sqlite3_finalize(stmt); break; } - ret = sqlite3_step(stmt); + + while(retry_count++ <= MAX_RETRY_COUNT) { + ret = sqlite3_step(stmt); + if (ret != SQLITE_BUSY) + break; + + apr_thread_mutex_unlock(sql->mutex); + apr_sleep(MAX_RETRY_SLEEP); + apr_thread_mutex_lock(sql->mutex); + } + *nrows = sqlite3_changes(sql->conn); sqlite3_finalize(stmt); length -= (tail - query);