Exemplo n.º 1
0
/*
 * ldap_mark_abandoned
 *
 * expects ld_res_mutex to be locked
 */
static int
ldap_mark_abandoned( LDAP *ld, ber_int_t msgid, int idx )
{
#ifdef LDAP_R_COMPILE
	LDAP_PVT_THREAD_ASSERT_MUTEX_OWNER( &ld->ld_res_mutex );
#endif

	/* NOTE: those assertions are repeated in ldap_int_bisect_delete() */
	assert( idx >= 0 );
	assert( idx < ld->ld_nabandoned );
	assert( ld->ld_abandoned[ idx ] == msgid );

	return ldap_int_bisect_delete( &ld->ld_abandoned, &ld->ld_nabandoned,
		msgid, idx );
}
Exemplo n.º 2
0
/*
 * ldap_mark_abandoned
 */
static int
ldap_mark_abandoned( LDAP *ld, ber_int_t msgid )
{
	int	ret, idx;

	assert( msgid >= 0 );
	LDAP_MUTEX_LOCK( &ld->ld_abandon_mutex );
	ret = ldap_int_bisect_find( ld->ld_abandoned, ld->ld_nabandoned, msgid, &idx );
	if (ret <= 0) {		/* error or already deleted by another thread */
		LDAP_MUTEX_UNLOCK( &ld->ld_abandon_mutex );
		return ret;
	}
	/* still in abandoned array, so delete */
	ret = ldap_int_bisect_delete( &ld->ld_abandoned, &ld->ld_nabandoned,
		msgid, idx );
	LDAP_MUTEX_UNLOCK( &ld->ld_abandon_mutex );
	return ret;
}