This is the mail archive of the glibc-bugs@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]

[Bug nptl/7007] New: PTHREAD_EXPLICIT_SCHED not honored after 'attr' is initialized to defaults


The POSIX.1-2001 specification of pthread_attr_init() says:

   The  pthread_attr_init()  function  shall  initialize  a thread
   attributes object attr with the default value for  all  of  the
   individual attributes used by a given implementation.

Among other things, pthread_attr_init() (quite reasonably) initializes the
scheduling policy to SCHED_OTHER, and the scheduling priority to 0.

The POSIX.1-2001 specification of pthread_attr_setinheritsched() says:

    PTHREAD_INHERIT_SCHED
          Specifies that the thread scheduling attributes shall be
          inherited  from  the creating thread, and the scheduling
          attributes in this attr argument shall be ignored.

    PTHREAD_EXPLICIT_SCHED
           Specifies that the thread scheduling attributes shall be
           set  to  the  corresponding  values from this attributes
           object.

Thus, as I read the standard, if we initialize a thread attribute object to the
defaults (using pthread_attr_init()), and then set the inheritsched attribute to
PTHREAD_EXPLICIT_SCHED, then a new thread created using this attribute object
should have its scheduling policy and priority set to SCHED_OTHER and 0,
respectively.  However, instead, these values are taken from the calling thread
(i.e., as though the inheritsched attribute had been set to
PTHREAD_INHERIT_SCHED).  As far as I can see this is in violation of the
specification and should be changed.

-- 
           Summary: PTHREAD_EXPLICIT_SCHED not honored after 'attr' is
                    initialized to defaults
           Product: glibc
           Version: 2.8
            Status: NEW
          Severity: normal
          Priority: P2
         Component: nptl
        AssignedTo: drepper at redhat dot com
        ReportedBy: mtk dot manpages at gmail dot com
                CC: glibc-bugs at sources dot redhat dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=7007

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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