]> git.sur5r.net Git - openldap/blobdiff - servers/slurpd/rq.c
Backend lock wasn't being released properly.
[openldap] / servers / slurpd / rq.c
index e34572797b1ed0535355abb914140ffe9dd10df2..4ef66727bd51014f8e0e09adbecd6f86089a5944 100644 (file)
 
 #include <stdio.h>
 
+#include <ac/stdlib.h>
+#include <ac/unistd.h>         /* get ftruncate() */
+
 #include "slurp.h"
 #include "globals.h"
 
 
-/* externs */
-extern void Re_dump LDAP_P(( Re *re ));
-
 /*
  * Lock the replication queue.
  */
@@ -50,7 +50,7 @@ Rq_lock(
     Rq *rq
 )
 {
-    return( pthread_mutex_lock( &rq->rq_mutex ));
+    return( ldap_pvt_thread_mutex_lock( &rq->rq_mutex ));
 }
 
 
@@ -62,7 +62,7 @@ Rq_unlock(
     Rq *rq
 )
 {
-    return( pthread_mutex_unlock( &rq->rq_mutex ));
+    return( ldap_pvt_thread_mutex_unlock( &rq->rq_mutex ));
 }
 
 
@@ -185,7 +185,7 @@ Rq_add(
     /* Increment count of items in queue */
     rq->rq_nre++;
     /* wake up any threads waiting for more work */
-    pthread_cond_broadcast( &rq->rq_more );
+    ldap_pvt_thread_cond_broadcast( &rq->rq_more );
 
     /* ... and unlock the queue */
     rq->rq_unlock( rq );
@@ -398,8 +398,8 @@ Rq_init(
     (*rq)->rq_getcount = Rq_getcount;
 
     /* Initialize private data */
-    pthread_mutex_init( &((*rq)->rq_mutex), pthread_mutexattr_default );
-    pthread_cond_init( &((*rq)->rq_more), pthread_condattr_default );
+    ldap_pvt_thread_mutex_init( &((*rq)->rq_mutex) );
+    ldap_pvt_thread_cond_init( &((*rq)->rq_more) );
     (*rq)->rq_head = NULL;
     (*rq)->rq_tail = NULL;
     (*rq)->rq_nre = 0;
@@ -408,4 +408,3 @@ Rq_init(
 
     return 0;
 }
-