All parameters for pthread_create from POSIX threads are pretty straightforward to understand, except pthread_attr_t. What is pthread_attr_t for, how, and when it is supposed to be not initialized by NULL?
I went through the Linux man page. The description I found about pthread_attr_t is:
Syntax:
int pthread_create(pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine) (void*),void *arg);
Explanation:
The attr argument points to a pthread_attr_t structure whose contents are used at thread creation time to determine attributes for the new thread; this structure is initialized using pthread_attr_init(3) and related functions. If attr is NULL, then the thread is created with default attributes.
Which is very unclear. I also googled all over the internet, and no clear explanation to be found anywhere either. So, when pthread_attr_t is not NULL?
Can someone please shed some light about that? All comments and feedback are highly appreciated.