FreeBSD/cddl/compat/opensolaris/misc/thread_pool.c
/*
 * Like tpool_destroy(), but don't cancel workers or wait for them to finish.
 * The last worker to terminate will delete the pool.
 */
Like tpool_destroy(), but don't cancel workers or wait for them to finish.
The last worker to terminate will delete the pool.
Like tpool_destroy () but don ' t cancel workers or wait for them to finish . The last worker to terminate will delete the pool .
void
tpool_abandon(tpool_t *tpool)
{
	pthread_mutex_lock(&tpool->tp_mutex);
	if (tpool->tp_current == 0) {
		pthread_mutex_unlock(&tpool->tp_mutex);
		delete_pool(tpool);
	} else {
		tpool->tp_flags |= TP_ABANDON;
		tpool->tp_flags &= ~TP_SUSPEND;
		(void) pthread_cond_broadcast(&tpool->tp_workcv);
		pthread_mutex_unlock(&tpool->tp_mutex);
	}
}
void tpool_abandon ( tpool_t * tpool ) { pthread_mutex_lock ( & tpool -> tp_mutex ) ; if ( tpool -> tp_current == 0 ) { pthread_mutex_unlock ( & tpool -> tp_mutex ) ; delete_pool ( tpool ) ; } else { tpool -> tp_flags |= TP_ABANDON ; tpool -> tp_flags &= ~ TP_SUSPEND ; ( void ) pthread_cond_broadcast ( & tpool -> tp_workcv ) ; pthread_mutex_unlock ( & tpool -> tp_mutex ) ; } }
Like tpool_destroy(), but don't cancel workers or wait for them to finish.
Like tpool_destroy () but don ' t cancel workers or wait for them to finish .
/* no workers, just delete the pool */ /* wake up all workers, last one will delete the pool */