cf_make_threadpool¶
Category: multithreading
GitHub: cute_multithreading.h
Returns an opaque CF_Threadpool pointer.
Parameters | Description |
---|---|
thread_count | The number of threads to spawn within the internal pool. |
Remarks¶
Call cf_destroy_threadpool when done. A threadpool manages a set of threads. Each thread sleeps until a task is placed
into the threadpool (see: CF_TaskFn). Once the task is completed, the thread attempts to fetch another task. If no more
tasks are available, the thread goes back to sleep. A common tactic is to take the number of cores in a given CPU and
subtract one, then use this number for thread_count
. We subtract one to account for the main thread.
Related Pages¶
CF_TaskFn
cf_threadpool_kick
cf_destroy_threadpool
cf_threadpool_add_task
cf_threadpool_kick_and_wait