]> git.sur5r.net Git - openldap/commitdiff
Add Pth specific r/w lock implementation.
authorKurt Zeilenga <kurt@openldap.org>
Wed, 7 Jun 2000 01:34:00 +0000 (01:34 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Wed, 7 Jun 2000 01:34:00 +0000 (01:34 +0000)
include/ldap_int_thread.h
libraries/libldap_r/thr_pth.c

index 5da7f13c176816f119170d49c443f68869cb6726..23cb1eb2a4eebd011746874ddef2a0f38caf587d 100644 (file)
@@ -89,6 +89,9 @@ typedef pth_t         ldap_int_thread_t;
 typedef pth_mutex_t    ldap_int_thread_mutex_t;
 typedef pth_cond_t     ldap_int_thread_cond_t;
 
+#define LDAP_THREAD_HAVE_RDWR 1
+typedef pth_rwlock_t ldap_pvt_thread_rdwr_t;
+
 LDAP_END_DECL
 
 
index 460dd8fee22afe74525c8fa1f2379f37abf6cd89..d35e485f2706bf1eab08e19eeb60f4cf4d60ff61 100644 (file)
@@ -140,4 +140,48 @@ ldap_int_thread_mutex_trylock( ldap_int_thread_mutex_t *mutex )
        return( pth_mutex_acquire( mutex, 1, NULL ) );
 }
 
+#ifdef LDAP_THREAD_HAVE_RDWR
+int 
+ldap_pvt_thread_rdwr_init( ldap_pvt_thread_rdwr_t *rw )
+{
+       return pth_rwlock_init( rw );
+}
+
+int 
+ldap_pvt_thread_rdwr_destroy( ldap_pvt_thread_rdwr_t *rw )
+{
+       return 0;
+}
+
+int ldap_pvt_thread_rdwr_rlock( ldap_pvt_thread_rdwr_t *rw )
+{
+       return pth_rwlock_acquire( rw, PTH_RWLOCK_RD, 0, NULL );
+}
+
+int ldap_pvt_thread_rdwr_rtrylock( ldap_pvt_thread_rdwr_t *rw )
+{
+       return pth_rwlock_acquire( rw, PTH_RWLOCK_RD, 1, NULL );
+}
+
+int ldap_pvt_thread_rdwr_runlock( ldap_pvt_thread_rdwr_t *rw )
+{
+       return pth_rwlock_release( rw );
+}
+
+int ldap_pvt_thread_rdwr_wlock( ldap_pvt_thread_rdwr_t *rw )
+{
+       return pth_rwlock_acquire( rw, PTH_RWLOCK_RW, 0, NULL );
+}
+
+int ldap_pvt_thread_rdwr_wtrylock( ldap_pvt_thread_rdwr_t *rw )
+{
+       return pth_rwlock_acquire( rw, PTH_RWLOCK_RW, 1, NULL );
+}
+
+int ldap_pvt_thread_rdwr_wunlock( ldap_pvt_thread_rdwr_t *rw )
+{
+       return pth_rwlock_release( rw );
+}
+
+#endif /* LDAP_THREAD_HAVE_RDWR */
 #endif /* HAVE_GNU_PTH */