https://github.com/srijanmukherjee/thread-pool-c
thread pool implementation in c
https://github.com/srijanmukherjee/thread-pool-c
Last synced: 3 months ago
JSON representation
thread pool implementation in c
- Host: GitHub
- URL: https://github.com/srijanmukherjee/thread-pool-c
- Owner: srijanmukherjee
- License: mit
- Created: 2023-08-13T20:29:23.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-08-13T20:32:02.000Z (almost 2 years ago)
- Last Synced: 2025-01-06T01:25:33.454Z (5 months ago)
- Language: C
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Threadpool in C
A very basic thread pool implementation in C.## Instructions
```bash
./build.sh
./bin/tpool-example
```Send SIGUSR1 signal to add a task to the pool.
**Note:** This is a very basic implementation, more features will be added in the near future.
## Usage
Include the `src/tpool.h` file into your project, and add `src/tpool.c` during compilation.
1. Creating a thread pool
```c
int tpool_init(tpool *pool, size_t thread_count);
```2. Adding a task to the pool
```c
ssize_t tpool_add_task(tpool *pool, void* (*start_routine)(void*), void* args);
```
**returns:** -1 on error, otherwise gives the assigned `task id`3. Destroying thread pool
```c
int tpool_destroy(tpool *pool);
```