You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by ni...@apache.org on 2005/10/14 15:34:50 UTC

svn commit: r321113 - in /apr/apr-util/trunk: dbd/apr_dbd.c include/private/apr_dbd_internal.h

Author: niq
Date: Fri Oct 14 06:34:44 2005
New Revision: 321113

URL: http://svn.apache.org/viewcvs?rev=321113&view=rev
Log:
Make dbd thread mutex available to DBD drivers

Modified:
    apr/apr-util/trunk/dbd/apr_dbd.c
    apr/apr-util/trunk/include/private/apr_dbd_internal.h

Modified: apr/apr-util/trunk/dbd/apr_dbd.c
URL: http://svn.apache.org/viewcvs/apr/apr-util/trunk/dbd/apr_dbd.c?rev=321113&r1=321112&r2=321113&view=diff
==============================================================================
--- apr/apr-util/trunk/dbd/apr_dbd.c (original)
+++ apr/apr-util/trunk/dbd/apr_dbd.c Fri Oct 14 06:34:44 2005
@@ -32,11 +32,26 @@
  * #define APR_DSO_BUILD APR_HAS_DSO
  */
 
-#if APR_DSO_BUILD
 #if APR_HAS_THREADS
 static apr_thread_mutex_t* mutex = NULL;
-#endif
+apr_status_t apr_dbd_mutex_lock()
+{
+    return apr_thread_mutex_lock(mutex);
+}
+apr_status_t apr_dbd_mutex_unlock()
+{
+    return apr_thread_mutex_unlock(mutex);
+}
 #else
+apr_status_t apr_dbd_mutex_lock() {
+    return APR_SUCCESS;
+}
+apr_status_t apr_dbd_mutex_unlock() {
+    return APR_SUCCESS;
+}
+#endif
+
+#ifndef APR_DSO_BUILD
 #define DRIVER_LOAD(name,driver,pool) \
     {   \
         extern const apr_dbd_driver_t driver; \
@@ -49,10 +64,9 @@
 
 APU_DECLARE(apr_status_t) apr_dbd_init(apr_pool_t *pool)
 {
-    apr_status_t ret;
+    apr_status_t ret = APR_SUCCESS;
     drivers = apr_hash_make(pool);
 
-#if APR_DSO_BUILD
 
 #if APR_HAS_THREADS
     ret = apr_thread_mutex_create(&mutex, APR_THREAD_MUTEX_DEFAULT, pool);
@@ -60,8 +74,7 @@
                               apr_pool_cleanup_null);
 #endif
 
-#else
-    ret = APR_SUCCESS;
+#ifndef APR_DSO_BUILD
 
 #if APU_HAVE_MYSQL
     DRIVER_LOAD("mysql", apr_dbd_mysql_driver, pool);
@@ -75,10 +88,13 @@
 #if APU_HAVE_SQLITE2
     DRIVER_LOAD("sqlite2", apr_dbd_sqlite2_driver, pool);
 #endif
+#if APU_HAVE_ORACLE
+    DRIVER_LOAD("oracle", apr_dbd_oracle_driver, pool);
+#endif
 #if APU_HAVE_SOME_OTHER_BACKEND
     DRIVER_LOAD("firebird", apr_dbd_other_driver, pool);
 #endif
-#endif
+#endif /* APR_DSO_BUILD */
     return ret;
 }
 APU_DECLARE(apr_status_t) apr_dbd_get_driver(apr_pool_t *pool, const char *name,

Modified: apr/apr-util/trunk/include/private/apr_dbd_internal.h
URL: http://svn.apache.org/viewcvs/apr/apr-util/trunk/include/private/apr_dbd_internal.h?rev=321113&r1=321112&r2=321113&view=diff
==============================================================================
--- apr/apr-util/trunk/include/private/apr_dbd_internal.h (original)
+++ apr/apr-util/trunk/include/private/apr_dbd_internal.h Fri Oct 14 06:34:44 2005
@@ -249,6 +249,9 @@
 
 };
 
+/* Export mutex lock/unlock for drivers that need it */
+apr_status_t apr_dbd_mutex_lock();
+apr_status_t apr_dbd_mutex_unlock();
 
 #ifdef __cplusplus
 }



Re: svn commit: r321113 - in /apr/apr-util/trunk: dbd/apr_dbd.c include/private/apr_dbd_internal.h

Posted by Garrett Rooney <ro...@electricjellyfish.net>.
On 10/14/05, niq@apache.org <ni...@apache.org> wrote:

>  #if APU_HAVE_MYSQL
>      DRIVER_LOAD("mysql", apr_dbd_mysql_driver, pool);
> @@ -75,10 +88,13 @@
>  #if APU_HAVE_SQLITE2
>      DRIVER_LOAD("sqlite2", apr_dbd_sqlite2_driver, pool);
>  #endif
> +#if APU_HAVE_ORACLE
> +    DRIVER_LOAD("oracle", apr_dbd_oracle_driver, pool);
> +#endif
>  #if APU_HAVE_SOME_OTHER_BACKEND
>      DRIVER_LOAD("firebird", apr_dbd_other_driver, pool);
>  #endif

Umm, somehow I don't think you intended to commit that APU_HAVE_ORACLE part ;-)

-garrett