This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

strangeness in pthread_create when not specifying "attr", or whenusing default attrs



I'm not sure if this is a bug, or bad documentation, or what.


The man pages for pthread_create() say that if you don't specify "attr", then the default scheduler class is used. The man page for pthread_attr_init() specifies that the default sched policy is SCHED_OTHER.

Based on my experimenting, if you put the original thread into the SCHED_RR class and give it a nonzero priority, then call pthread_create() with "attr" of NULL, the new thread will end up with the same scheduler parameters as the thread that created it. Doesn't this violate the stated semantics?

Also, the default attribute for the "inheritsched" attribute is supposed to be that you do not inherit the scheduler parameters, which would seem to imply that ATTR_FLAG_NOTINHERITSCHED should be *set*. However, based on the code pthread_attr_init() simply sets everything to zero, then sets the guardsize member. This means that for me to specify scheduler attributes I have to explicitly set PTHREAD_EXPLICIT_SCHED even though it's supposed to be the default.

Anyone have any comments?


Chris



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]