runqueue locking fix (ITS#2746)

This commit is contained in:
Jong Hyuk Choi 2003-10-12 09:13:04 +00:00
parent 4f003dbdaf
commit 85ff0377d2
2 changed files with 3 additions and 1 deletions

View file

@ -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;
}

View file

@ -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 ) {