]> git.sur5r.net Git - openldap/commitdiff
Use pthread rwlocks, if available
authorKurt Zeilenga <kurt@openldap.org>
Wed, 7 Jun 2000 00:28:35 +0000 (00:28 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Wed, 7 Jun 2000 00:28:35 +0000 (00:28 +0000)
include/ldap_int_thread.h
include/ldap_pvt_thread.h
include/portable.h.in
libraries/libldap_r/libldap_r.dsp
libraries/libldap_r/rdwr.c
libraries/libldap_r/thr_posix.c

index 7f0257cdfaf4f1823015330eeff25d8379836633..5da7f13c176816f119170d49c443f68869cb6726 100644 (file)
@@ -49,6 +49,11 @@ typedef pthread_cond_t               ldap_int_thread_cond_t;
 #define HAVE_SETCONCURRENCY 1
 #endif
 
+#if defined( HAVE_PTHREAD_RWLOCK_DESTROY )
+#define LDAP_THREAD_HAVE_RDWR 1
+typedef pthread_rwlock_t ldap_pvt_thread_rdwr_t;
+#endif
+
 LDAP_END_DECL
 
 #elif defined ( HAVE_MACH_CTHREADS )
index f336feafa95b698cedcd6496d80ecaec768ea991..668f58a1eb689d93b36e40d8e26f273fb78a3765 100644 (file)
@@ -96,6 +96,7 @@ ldap_pvt_thread_mutex_trylock LDAP_P(( ldap_pvt_thread_mutex_t *mutex ));
 LIBLDAP_F( int )
 ldap_pvt_thread_mutex_unlock LDAP_P(( ldap_pvt_thread_mutex_t *mutex ));
 
+#ifndef LDAP_THREAD_HAVE_RDWR
 typedef struct ldap_pvt_thread_rdwr_var {
        ldap_pvt_thread_mutex_t ltrw_mutex;     
        ldap_pvt_thread_cond_t ltrw_read;       /* wait for read */
@@ -107,6 +108,7 @@ typedef struct ldap_pvt_thread_rdwr_var {
        int ltrw_r_wait;
        int ltrw_w_wait;
 } ldap_pvt_thread_rdwr_t;
+#endif
 
 LIBLDAP_F( int )
 ldap_pvt_thread_rdwr_init LDAP_P((ldap_pvt_thread_rdwr_t *rdwrp));
index 6da42a598e675b0268eb03f1f44d3589b9f02626..03d346c282eb2defb8514a422ffee69fb5a9a811 100644 (file)
 
 /* end of preamble */
 
+#if !defined(SLAPD_SCHEMA_COMPAT) && !defined(SLAPD_SCHEMA_NOT_COMPAT)
+       /* define SLAPD_SCHEMA_COMPAT if you want old schema codes */
+#define SLAPD_SCHEMA_NOT_COMPAT 1
+#endif
+
+
 /* Define if on AIX 3.
    System headers sometimes define this.
    We just want to avoid a redefinition error message.  */
 /* Define if you have the pthread_kill function.  */
 #undef HAVE_PTHREAD_KILL
 
+/* Define if you have the pthread_rwlock_destroy function.  */
+#undef HAVE_PTHREAD_RWLOCK_DESTROY
+
 /* Define if you have the pthread_setconcurrency function.  */
 #undef HAVE_PTHREAD_SETCONCURRENCY
 
index fe699a88acf3f3f28b934ff6420da82cb721e543..29e1d8d776bb548eb2622b397b187e1a184ed9e4 100644 (file)
@@ -336,6 +336,10 @@ SOURCE=.\thr_stub.c
 # End Source File
 # Begin Source File
 
+SOURCE=.\threads.c
+# End Source File
+# Begin Source File
+
 SOURCE=..\libldap\tls.c
 # End Source File
 # Begin Source File
index 75757adb7d36a2df35f67c457077dfccf46fa63d..e97fe7143ca6060c37c0ecf7a685a89d95712bb1 100644 (file)
@@ -226,7 +226,7 @@ int ldap_pvt_thread_rdwr_wunlock( ldap_pvt_thread_rdwr_t *rw )
        return 0;
 }
 
-#ifdef LDAP_DEBUG
+#ifdef LDAP_RDWR_DEBUG
 
 /* just for testing, 
  * return 0 if false, suitable for assert(ldap_pvt_thread_rdwr_Xchk(rdwr))
index b66cf7861cdfb7112e56885d76f3068b33021a5e..f6a16c5d2a5ea5ab7aa42a337f33ce0df9ee8e49 100644 (file)
@@ -218,5 +218,49 @@ ldap_int_thread_mutex_unlock( ldap_int_thread_mutex_t *mutex )
        return pthread_mutex_unlock( mutex );
 }
 
+#ifdef HAVE_PTHREAD_RWLOCK_DESTROY
+int 
+ldap_pvt_thread_rdwr_init( ldap_pvt_thread_rdwr_t *rw )
+{
+       return pthread_rwlock_init( rw, NULL );
+}
+
+int 
+ldap_pvt_thread_rdwr_destroy( ldap_pvt_thread_rdwr_t *rw )
+{
+       return pthread_rwlock_destroy( rw );
+}
+
+int ldap_pvt_thread_rdwr_rlock( ldap_pvt_thread_rdwr_t *rw )
+{
+       return pthread_rwlock_rdlock( rw );
+}
+
+int ldap_pvt_thread_rdwr_rtrylock( ldap_pvt_thread_rdwr_t *rw )
+{
+       return pthread_rwlock_tryrdlock( rw );
+}
+
+int ldap_pvt_thread_rdwr_runlock( ldap_pvt_thread_rdwr_t *rw )
+{
+       return pthread_rwlock_unlock( rw );
+}
+
+int ldap_pvt_thread_rdwr_wlock( ldap_pvt_thread_rdwr_t *rw )
+{
+       return pthread_rwlock_wrlock( rw );
+}
+
+int ldap_pvt_thread_rdwr_wtrylock( ldap_pvt_thread_rdwr_t *rw )
+{
+       return pthread_rwlock_trywrlock( rw );
+}
+
+int ldap_pvt_thread_rdwr_wunlock( ldap_pvt_thread_rdwr_t *rw )
+{
+       return pthread_rwlock_unlock( rw );
+}
+
+#endif /* LDAP_THREAD_HAVE_RDWR */
 #endif /* HAVE_PTHREADS */