C-Thread-Pool icon indicating copy to clipboard operation
C-Thread-Pool copied to clipboard

A minimal but powerful thread pool in ANSI C

Results 47 C-Thread-Pool issues
Sort by recently updated
recently updated
newest added

Fixes the error message "thread_do(): pthread_setname_np is not supported on this system" in FreeBSD. Tested on Linux and in a FreeBSD virtual machine.

bsem *has_jobs; why not just a condition variable?

This should prevent the race conditions when destroying and initializing multiple threadpools at the same time Also see #88

I have several thread pools that might be created and destroyed and different times. Is there any reason not to include `threads_keepalive` in `thpool_` struct?

Hi, There is ``` pthread_mutex_init(&(thpool_p->thcount_lock), NULL); pthread_cond_init(&thpool_p->threads_all_idle, NULL); ``` But I can't find `pthread_mutex_destroy` and `pthread_cond_destroy` call, should those two functions be called at `thpool_destroy()`? Thanks.

``` struct thpool_* thpool_init(int num_threads){ threads_on_hold = 0; threads_keepalive = 1; - if (num_threads < 0){ - num_threads = 0; - } + if (num_threads < 1){ + num_threads =...

I have managed to port the example to use on [Zephyr](https://www.zephyrproject.org/) RTOS on STM32L4 - Cortex M4 MCU. I would like to add it to the codebase. Is it interested,...

Thread name should not exceed 16 bytes according to [prctl API documentation](https://man7.org/linux/man-pages/man2/prctl.2.html). PR_SET_NAME (since Linux 2.6.9) Set the name of the calling thread, using the value in the location pointed...

Hi, thanks for this awesome lib. In thpool.c (line 37), here is `static volatile int threads_keepalive;` , why not put `threads_keepalive` on `struct thpool_`? Assume the following scenario: 1. Create...

It will be a nice to have feature if the user can add a job along with its priority so that the higher priority job can be completed first even...