Pithikos / C-Thread-Pool

A minimal but powerful thread pool in ANSI C
MIT License
2.06k stars 603 forks source link

Additional function that allows passing pthread_attr_t during thread pool initialization #63

Closed vpetrigo closed 9 months ago

vpetrigo commented 6 years ago

Hello,

First of all, I'd like to say thank you for your library. I want to propose extension of current thread pool initialization process in order to be able to pass pthread attribute to underneath threads which are created in a pool. It might be done via additional method like:

const pthread_attr_t *internal_pattr_variable = NULL;
//...
void thpool_set_attr(const pthread_attr_t *pattr)
{
    internal_pattr_variable = pattr;
}

By doing so we can check whether our internal_pattr_variable is not NULL in the thread_init call and if so, apply the provided attributes to the brand new threads.

If you do not mind I can do that and send a pull request.

Pithikos commented 9 months ago

Closing this due to little traction