Return-Path: Delivered-To: apmail-apr-commits-archive@www.apache.org Received: (qmail 21154 invoked from network); 14 Oct 2005 14:20:49 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 14 Oct 2005 14:20:49 -0000 Received: (qmail 47427 invoked by uid 500); 14 Oct 2005 14:20:48 -0000 Delivered-To: apmail-apr-commits-archive@apr.apache.org Received: (qmail 47365 invoked by uid 500); 14 Oct 2005 14:20:48 -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 47351 invoked by uid 99); 14 Oct 2005 14:20:48 -0000 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; Fri, 14 Oct 2005 07:20:47 -0700 Received: (qmail 21058 invoked by uid 65534); 14 Oct 2005 14:20:27 -0000 Message-ID: <20051014142027.21042.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r321132 - /apr/apr-util/trunk/dbd/apr_dbd_sqlite3.c Date: Fri, 14 Oct 2005 14:20:27 -0000 To: commits@apr.apache.org From: niq@apache.org X-Mailer: svnmailer-1.0.5 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: niq Date: Fri Oct 14 07:20:22 2005 New Revision: 321132 URL: http://svn.apache.org/viewcvs?rev=321132&view=rev Log: Update sqlite3 driver to use apr_dbd mutex rather than create its own Modified: apr/apr-util/trunk/dbd/apr_dbd_sqlite3.c Modified: apr/apr-util/trunk/dbd/apr_dbd_sqlite3.c URL: http://svn.apache.org/viewcvs/apr/apr-util/trunk/dbd/apr_dbd_sqlite3.c?rev=321132&r1=321131&r2=321132&view=diff ============================================================================== --- apr/apr-util/trunk/dbd/apr_dbd_sqlite3.c (original) +++ apr/apr-util/trunk/dbd/apr_dbd_sqlite3.c Fri Oct 14 07:20:22 2005 @@ -39,7 +39,6 @@ struct apr_dbd_t { sqlite3 *conn; apr_dbd_transaction_t *trans; - apr_thread_mutex_t *mutex; apr_pool_t *pool; }; @@ -92,11 +91,11 @@ return sql->trans->errnum; } - apr_thread_mutex_lock(sql->mutex); + apr_dbd_mutex_lock(); ret = sqlite3_prepare(sql->conn, query, strlen(query), &stmt, &tail); if (!dbd_sqlite3_is_success(ret)) { - apr_thread_mutex_unlock(sql->mutex); + apr_dbd_mutex_unlock(); return ret; } else { int column_count; @@ -115,9 +114,9 @@ if (retry_count++ > MAX_RETRY_COUNT) { ret = SQLITE_ERROR; } else { - apr_thread_mutex_unlock(sql->mutex); + apr_dbd_mutex_unlock(); apr_sleep(MAX_RETRY_SLEEP); - apr_thread_mutex_lock(sql->mutex); + apr_dbd_mutex_lock(); } } else if (ret == SQLITE_ROW) { int length; @@ -170,7 +169,7 @@ } while (ret == SQLITE_ROW || ret == SQLITE_BUSY); } ret = sqlite3_finalize(stmt); - apr_thread_mutex_unlock(sql->mutex); + apr_dbd_mutex_unlock(); if (sql->trans) { sql->trans->errnum = ret; @@ -233,7 +232,7 @@ } length = strlen(query); - apr_thread_mutex_lock(sql->mutex); + apr_dbd_mutex_lock(); do { ret = sqlite3_prepare(sql->conn, query, length, &stmt, &tail); @@ -251,7 +250,7 @@ if (dbd_sqlite3_is_success(ret)) { ret = 0; } - apr_thread_mutex_unlock(sql->mutex); + apr_dbd_mutex_unlock(); if (sql->trans) { sql->trans->errnum = ret; } @@ -357,12 +356,6 @@ sql->conn = conn; sql->pool = pool; sql->trans = NULL; - /* Create a mutex */ - res = apr_thread_mutex_create(&sql->mutex, APR_THREAD_MUTEX_DEFAULT, - pool); - if (res != APR_SUCCESS) { - return NULL; - } return sql; } @@ -370,7 +363,6 @@ static apr_status_t dbd_sqlite3_close(apr_dbd_t *handle) { sqlite3_close(handle->conn); - apr_thread_mutex_destroy(handle->mutex); return APR_SUCCESS; }