Skip to content
A simple implementation of thread pool.
C Makefile
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Makefile
README.md
benchmask.c
test.c
thread_pool.c
thread_pool.h

README.md

thread_pool

实现一个简单的线程池。

http://progrom.cn/2017/08/06/thread-pool-implementation/

测试

编译链接

make

运行测试

make run

用法

定义线程池变量

thread_pool_t pool;

初始化线程池变量

thread_pool_init(thread_pool_t *pool, int pool_size, int queue_size);

定义任务变量

thread_task_t task;

初始化任务变量

thread_task_init(thread_task_t *task, void (*func)(void *), void *argv);

将任务放入线程池执行

thread_pool_execute(thread_pool_t *pool, thread_task_t *task);

关闭线程池

thread_pool_shutdown(thread_pool_t *pool, int now);
You can’t perform that action at this time.