apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n..@apache.org
Subject svn commit: r321132 - /apr/apr-util/trunk/dbd/apr_dbd_sqlite3.c
Date Fri, 14 Oct 2005 14:20:27 GMT
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;
 }
 



Mime
View raw message