Skip to content

srijanmukherjee/thread-pool-c

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Threadpool in C

A very basic thread pool implementation in C.

Instructions

./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
int tpool_init(tpool *pool, size_t thread_count);
  1. Adding a task to the pool
ssize_t tpool_add_task(tpool *pool, void* (*start_routine)(void*), void* args);

returns: -1 on error, otherwise gives the assigned task id

  1. Destroying thread pool
int tpool_destroy(tpool *pool);

About

thread pool implementation in c

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published