From: Jong Hyuk Choi Date: Sun, 12 Oct 2003 09:13:04 +0000 (+0000) Subject: runqueue locking fix (ITS#2746) X-Git-Tag: OPENLDAP_REL_ENG_2_1_MP~588 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=85ff0377d209c0a2d7b2905a7ae1ba47c402e140;p=openldap runqueue locking fix (ITS#2746) --- 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 ) {