This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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]

[PATCH/RFA] Protect use of optional features in gthr-posix.h


gthr-posix.h uses features not found in the base POSIX threads definition.
In particular, it uses features from the Threads Priority Scheduling group,
who's use should be protected by a feature test.

While here, I also fixed what seems to be a bug in the use of
sched_get_priority_max()/sched_get_priority_min().  Those functions
are defined to return -1 on error, but the way they were being used
treats any non-0 return as an error?

Bootstrapped/regtested on alpha-unknown-netbsd with --enable-threads
(with Jan's toplev.c patch).

OK for mainline?

	* gthr-posix.h: Include <unistd.h> for feature tests.
	(sched_get_priority_max, sched_get_priority_min)
	(pthread_getschedparam, pthread_setschedparam): Only use
	if _POSIX_THREAD_PRIORITY_SCHEDULING is defined.
	(__gthread_objc_thread_set_priority): Don't treat all non-zero
	returns from sched_get_priority_max and sched_get_priority_min
	as an error.

-- 
        -- Jason R. Thorpe <thorpej@wasabisystems.com>

Attachment: gthr-patch
Description: Text document


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