Closed Bug 4176 Opened 25 years ago Closed 25 years ago

Feature test macro for pthread_attr_setscope

Categories

(NSPR :: NSPR, defect, P3)

Other
FreeBSD
defect

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: wtc, Assigned: wtc)

Details

(Whiteboard: awaiting permission to verify)

This bug is reported by karp@eecs.harvard.edu (Brad Karp).

In mozilla/nsprpub/pr/src/pthreads/ptthread.c, we have
some pthread_attr_setscope() calls ifdef'd with
PTHREAD_SCOPE_SYSTEM.  On FreeBSD (3.1 and 4.0),
the symbol pthread_attr_setscope is unresolved.
This is because the pthread.h header on FreeBSD
defines the macro PTHREAD_SCOPE_SYSTEM but the
function pthread_attr_setscope is not implemented.

The pthread_attr_setscope documentation
(http://www.opengroup.org/onlinepubs/007908799/xsh/pthread_attr_getscope.html)
seems to indicate that the pthreads feature macro
we should test to determine whether pthread_attr_setscope
is supported is _POSIX_THREAD_PRIORITY_SCHEDULING.

I suggest that we change the code to test for
_POSIX_THREAD_PRIORITY_SCHEDULING instead of
PTHREAD_SCOPE_SYSTEM.
Status: NEW → ASSIGNED
Accepted the bug.

Added briano@netscape.com to the cc list.
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
Confirmed that _POSIX_THREAD_PRIORITY_SCHEDULING
is the feature-test macro for pthread_attr_setscope.
(See Dave Butenhof's Programming with POSIX Threads,
p. 330.)

jon@eyrie.org (Jonathan Lennox) also posted this
patch in the netscape.public.mozilla.nspr newsgroup.

The fix is checked into the tip.
/cvsroot/mozilla/nsprpub/pr/src/pthreads/ptthread.c, revision 3.17.
Also checked into the internal CVS repository.
/m/src/ns/nspr20/pr/src/pthreads/ptthread.c, revision 2.45.
Whiteboard: awaiting permission to verify
wan-teh, since this is a low level fix, can you please verify it, or
tell me how to do it myself?
Status: RESOLVED → VERIFIED
Marked bug as verified.
NSPR now has its own Bugzilla product.  Moving this bug to the NSPR product.
You need to log in before you can comment on or make changes to this bug.