Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/srijanmukherjee/thread-pool-c
thread pool implementation in c
https://github.com/srijanmukherjee/thread-pool-c
Last synced: 9 days 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 (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-08-13T20:32:02.000Z (over 1 year ago)
- Last Synced: 2023-08-13T21:41:34.034Z (over 1 year 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);
```