ITS#8958 rename ldap_pvt_thread_pool_pausecheck()

to ..._pausewait() since that's what it really does.
Add ..._pausequery() that only checks and doesn't wait.
This commit is contained in:
Howard Chu 2021-08-05 15:50:27 +01:00 committed by Quanah Gibson-Mount
parent 81ed9e0d0e
commit 5ad6ab3568
5 changed files with 26 additions and 7 deletions

View File

@ -279,7 +279,11 @@ ldap_pvt_thread_pool_unidle LDAP_P((
ldap_pvt_thread_pool_t *pool ));
LDAP_F( int )
ldap_pvt_thread_pool_pausecheck LDAP_P((
ldap_pvt_thread_pool_pausequery LDAP_P((
ldap_pvt_thread_pool_t *pool ));
LDAP_F( int )
ldap_pvt_thread_pool_pausewait LDAP_P((
ldap_pvt_thread_pool_t *pool ));
LDAP_F( int )

View File

@ -1236,11 +1236,26 @@ ldap_pvt_thread_pool_unidle( ldap_pvt_thread_pool_t *tpool )
* Return 1 if we waited, 0 if not, -1 at parameter error.
*/
int
ldap_pvt_thread_pool_pausecheck( ldap_pvt_thread_pool_t *tpool )
ldap_pvt_thread_pool_pausewait( ldap_pvt_thread_pool_t *tpool )
{
return handle_pause(tpool, PAUSE_ARG(CHECK_PAUSE));
}
/* Return 1 if a pause has been requested */
int
ldap_pvt_thread_pool_pausequery( ldap_pvt_thread_pool_t *tpool )
{
struct ldap_int_thread_pool_s *pool;
if ( !tpool )
return -1;
pool = *tpool;
if ( !pool )
return 0;
return pool->ltp_pause != 0;
}
/*
* Wait for a pause, from a non-pooled thread.
*/

View File

@ -765,7 +765,7 @@ accesslog_purge( void *ctx, void *arg )
}
ch_free( pd.ndn[i].bv_val );
ch_free( pd.dn[i].bv_val );
ldap_pvt_thread_pool_pausecheck( &connection_pool );
ldap_pvt_thread_pool_pausewait( &connection_pool );
}
ch_free( pd.ndn );
ch_free( pd.dn );

View File

@ -2723,7 +2723,7 @@ retry:
if ( slapd_shutdown )
return SLAPD_ABANDON;
if ( !ldap_pvt_thread_pool_pausecheck( &connection_pool ))
if ( !ldap_pvt_thread_pool_pausewait( &connection_pool ))
ldap_pvt_thread_yield();
ldap_pvt_thread_mutex_lock( &mt->mt_mutex );
@ -3112,7 +3112,7 @@ syncprov_op_search( Operation *op, SlapReply *rs )
ch_free( sop );
return SLAPD_ABANDON;
}
if ( !ldap_pvt_thread_pool_pausecheck( &connection_pool ))
if ( !ldap_pvt_thread_pool_pausewait( &connection_pool ))
ldap_pvt_thread_yield();
ldap_pvt_thread_mutex_lock( &si->si_ops_mutex );
}

View File

@ -1210,7 +1210,7 @@ get_pmutex(
while ( ldap_pvt_thread_mutex_trylock( &si->si_cookieState->cs_pmutex )) {
if ( slapd_shutdown )
return SYNC_SHUTDOWN;
if ( !ldap_pvt_thread_pool_pausecheck( &connection_pool ))
if ( !ldap_pvt_thread_pool_pausewait( &connection_pool ))
ldap_pvt_thread_yield();
}
}
@ -1972,7 +1972,7 @@ do_syncrepl(
while ( ldap_pvt_thread_mutex_trylock( &si->si_mutex )) {
if ( slapd_shutdown )
return NULL;
if ( !ldap_pvt_thread_pool_pausecheck( &connection_pool ))
if ( !ldap_pvt_thread_pool_pausewait( &connection_pool ))
ldap_pvt_thread_yield();
}