mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-31 03:59:34 -05:00
ITS#9878 Treat tasks with interval == 0 as one-shot
Some tasks need to be run once at a given time or the earliest opportunity, also currently, using interval == 0 on a task triggers a busy loop inside the scheduling task, halting progress for other tasks and any other work usually serviced by that thread. This change deals with both issues at the same time.
This commit is contained in:
parent
294a16c10c
commit
29c3a443d8
1 changed files with 4 additions and 2 deletions
|
|
@ -2788,11 +2788,13 @@ loop:
|
|||
ldap_pvt_thread_mutex_lock( &slapd_rq.rq_mutex );
|
||||
rtask = ldap_pvt_runqueue_next_sched( &slapd_rq, &cat );
|
||||
while ( rtask && cat.tv_sec && cat.tv_sec <= now ) {
|
||||
/* ITS#9878 If interval == 0, this task was meant to be one-shot */
|
||||
int defer = !rtask->interval.tv_sec;
|
||||
if ( ldap_pvt_runqueue_isrunning( &slapd_rq, rtask )) {
|
||||
ldap_pvt_runqueue_resched( &slapd_rq, rtask, 0 );
|
||||
ldap_pvt_runqueue_resched( &slapd_rq, rtask, defer );
|
||||
} else {
|
||||
ldap_pvt_runqueue_runtask( &slapd_rq, rtask );
|
||||
ldap_pvt_runqueue_resched( &slapd_rq, rtask, 0 );
|
||||
ldap_pvt_runqueue_resched( &slapd_rq, rtask, defer );
|
||||
ldap_pvt_thread_mutex_unlock( &slapd_rq.rq_mutex );
|
||||
ldap_pvt_thread_pool_submit2( &connection_pool,
|
||||
slapd_rtask_trampoline, (void *) rtask, &rtask->pool_cookie );
|
||||
|
|
|
|||
Loading…
Reference in a new issue