thread/m_threadpool.c
/*! Shuts down the thread pool, waits for all threads to exit.
 *  \param pool initialized threadpool */
Shuts down the thread pool, waits for all threads to exit.
\param pool initialized threadpool
Shuts down the thread pool waits for all threads to exit . \ param pool initialized threadpool
void M_threadpool_destroy(M_threadpool_t *pool)
{
	if (pool == NULL)
		return;
	M_thread_mutex_lock(pool->queue_lock);
	pool->up = M_FALSE;
	M_thread_cond_broadcast(pool->queue_ocond);
	while (pool->num_threads) {
		M_thread_cond_wait(pool->queue_icond, pool->queue_lock);
	}
	M_thread_mutex_unlock(pool->queue_lock);
	M_threadpool_queue_finish(pool);
	M_free(pool);
}
void M_threadpool_destroy ( M_threadpool_t * pool ) { if ( pool == NULL ) return ; M_thread_mutex_lock ( pool -> queue_lock ) ; pool -> up = M_FALSE ; M_thread_cond_broadcast ( pool -> queue_ocond ) ; while ( pool -> num_threads ) { M_thread_cond_wait ( pool -> queue_icond , pool -> queue_lock ) ; } M_thread_mutex_unlock ( pool -> queue_lock ) ; M_threadpool_queue_finish ( pool ) ; M_free ( pool ) ; }
Shuts down the thread pool, waits for all threads to exit.
Shuts down the thread pool waits for all threads to exit .
/* Tell all threads to shutdown */ /* Wait for all threads to shutdown.  The last thread will signal
	 * queue_icond when it exits so we know, but we need to handle
	 * spurious wakeups as well. */ /* Cleanup */