silc_thread_pool_alloc
SYNOPSIS
SilcThreadPool silc_thread_pool_alloc(SilcStack stack, SilcUInt32 min_threads, SilcUInt32 max_threads, SilcBool start_min_threads);
DESCRIPTION
Allocate thread pool with at least `min_threads' and at most `max_threads' many threads. If `start_min_threads' is TRUE this will start `min_threads' many threads immediately. Returns the thread pool context or NULL on error. If `stack' is non-NULL memory is allocated from `stack'. When the thread pool is freed the memory is returned to `stack'.
EXAMPLE
// Start thread pool, by default it has 0 threads. pool = silc_thread_pool_alloc(NULL, 0, 5, FALSE); // Function to execute in a thread void my_func(SilcSchedule schedule, void *context) { MyContext mycontext = context; ... } // Execute code in a thread in the pool silc_thread_pool_run(pool, TRUE, NULL, my_func, my_context, NULL, NULL);