From 85ff0377d209c0a2d7b2905a7ae1ba47c402e140 Mon Sep 17 00:00:00 2001 From: Jong Hyuk Choi Date: Sun, 12 Oct 2003 09:13:04 +0000 Subject: [PATCH] runqueue locking fix (ITS#2746) --- libraries/libldap_r/rq.c | 2 ++ servers/slapd/daemon.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/libraries/libldap_r/rq.c b/libraries/libldap_r/rq.c index 88851efeb7..16a8111501 100644 --- a/libraries/libldap_r/rq.c +++ b/libraries/libldap_r/rq.c @@ -174,12 +174,14 @@ ldap_pvt_runqueue_persistent_backload( struct re_s* e; int count = 0; + ldap_pvt_thread_mutex_lock( &rq->rq_mutex ); if ( !LDAP_STAILQ_EMPTY( &rq->task_list )) { LDAP_STAILQ_FOREACH( e, &rq->task_list, tnext ) { if ( e->next_sched.tv_sec == 0 ) count++; } } + ldap_pvt_thread_mutex_unlock( &rq->rq_mutex ); return count; } diff --git a/servers/slapd/daemon.c b/servers/slapd/daemon.c index d83974bece..c8283828bd 100644 --- a/servers/slapd/daemon.c +++ b/servers/slapd/daemon.c @@ -1358,9 +1358,9 @@ slapd_daemon_task( ldap_pvt_thread_pool_submit( &connection_pool, rtask->routine, (void *) rtask ); } + ldap_pvt_thread_mutex_lock( &syncrepl_rq.rq_mutex ); rtask = ldap_pvt_runqueue_next_sched( &syncrepl_rq, &cat ); } - rtask = ldap_pvt_runqueue_next_sched( &syncrepl_rq, &cat ); ldap_pvt_thread_mutex_unlock( &syncrepl_rq.rq_mutex ); if ( cat != NULL ) { -- 2.39.5