From 1885ae7794ea6aa441ef88b8f469178b8af64a87 Mon Sep 17 00:00:00 2001 From: fedor Date: Sat, 28 Jun 2003 02:16:54 +0000 Subject: [PATCH] Check for sched implementation (for netbsdelf) git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/libobjc/trunk@17055 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog.GNUstep | 9 +++++++++ GNUmakefile | 3 +++ thr-posix.c | 9 +++++++++ 3 files changed, 21 insertions(+) diff --git a/ChangeLog.GNUstep b/ChangeLog.GNUstep index d577f82..d547b63 100644 --- a/ChangeLog.GNUstep +++ b/ChangeLog.GNUstep @@ -1,3 +1,12 @@ +2003-06-27 Adam Fedor + + * thr-posix.c: Add sched_param struct if missing + (__objc_thread_set_priority): Check for implementation + of priority scheduling. + * GNUmakefile (ADDITIONAL_CPPFLAGS): Mark sched_param as missing + on netbsdelf. (Rewritten from bug submited by Peter Cooper + . + 2003-05-20 Adam Fedor * GNUmakefile (VERSION): 1.3.0 diff --git a/GNUmakefile b/GNUmakefile index 4607819..a92c99d 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -48,6 +48,9 @@ CLIBRARY_NAME = libobjc # dce, decosf1, irix, mach, os2, posix, pthreads, single, solaris, vxworks THREADING = posix +ifeq ($(GNUSTEP_TARGET_OS),netbsdelf) +ADDITIONAL_CPPFLAGS += -DMISSING_SCHED_PARAM_STRUCT +endif ifeq ($(GNUSTEP_TARGET_OS),mingw32) THREADING = win32 endif diff --git a/thr-posix.c b/thr-posix.c index 71a9660..410d6fd 100644 --- a/thr-posix.c +++ b/thr-posix.c @@ -30,6 +30,12 @@ Boston, MA 02111-1307, USA. */ #include "runtime.h" #include +#ifdef MISSING_SCHED_PARAM_STRUCT +struct sched_param { + int sched_priority; +}; +#endif + /* Key structure for maintaining thread specific storage */ static pthread_key_t _objc_thread_storage; static pthread_attr_t _objc_thread_attribs; @@ -96,6 +102,7 @@ __objc_thread_detach(void (*func)(void *arg), void *arg) int __objc_thread_set_priority(int priority) { +#if defined(_POSIX_THREAD_PRIORITY_SCHEDULING) pthread_t thread_id = pthread_self(); int policy; struct sched_param params; @@ -123,6 +130,8 @@ __objc_thread_set_priority(int priority) if (pthread_setschedparam(thread_id, policy, ¶ms) == 0) return 0; } +#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */ + return -1; }