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
main
fedor 23 years ago
parent 828893a338
commit 1885ae7794

@ -1,3 +1,12 @@
2003-06-27 Adam Fedor <fedor@gnu.org>
* 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
<comrade@obverse.com.au>.
2003-05-20 Adam Fedor <fedor@gnu.org> 2003-05-20 Adam Fedor <fedor@gnu.org>
* GNUmakefile (VERSION): 1.3.0 * GNUmakefile (VERSION): 1.3.0

@ -48,6 +48,9 @@ CLIBRARY_NAME = libobjc
# dce, decosf1, irix, mach, os2, posix, pthreads, single, solaris, vxworks # dce, decosf1, irix, mach, os2, posix, pthreads, single, solaris, vxworks
THREADING = posix THREADING = posix
ifeq ($(GNUSTEP_TARGET_OS),netbsdelf)
ADDITIONAL_CPPFLAGS += -DMISSING_SCHED_PARAM_STRUCT
endif
ifeq ($(GNUSTEP_TARGET_OS),mingw32) ifeq ($(GNUSTEP_TARGET_OS),mingw32)
THREADING = win32 THREADING = win32
endif endif

@ -30,6 +30,12 @@ Boston, MA 02111-1307, USA. */
#include "runtime.h" #include "runtime.h"
#include <pthread.h> #include <pthread.h>
#ifdef MISSING_SCHED_PARAM_STRUCT
struct sched_param {
int sched_priority;
};
#endif
/* Key structure for maintaining thread specific storage */ /* Key structure for maintaining thread specific storage */
static pthread_key_t _objc_thread_storage; static pthread_key_t _objc_thread_storage;
static pthread_attr_t _objc_thread_attribs; static pthread_attr_t _objc_thread_attribs;
@ -96,6 +102,7 @@ __objc_thread_detach(void (*func)(void *arg), void *arg)
int int
__objc_thread_set_priority(int priority) __objc_thread_set_priority(int priority)
{ {
#if defined(_POSIX_THREAD_PRIORITY_SCHEDULING)
pthread_t thread_id = pthread_self(); pthread_t thread_id = pthread_self();
int policy; int policy;
struct sched_param params; struct sched_param params;
@ -123,6 +130,8 @@ __objc_thread_set_priority(int priority)
if (pthread_setschedparam(thread_id, policy, &params) == 0) if (pthread_setschedparam(thread_id, policy, &params) == 0)
return 0; return 0;
} }
#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
return -1; return -1;
} }

Loading…
Cancel
Save