pkgsrc/devel/gnustep-objc/patches/patch-aa
2003-01-21 12:41:26 +00:00

63 lines
1.6 KiB
Text

$NetBSD: patch-aa,v 1.2 2003/01/21 12:41:27 rh Exp $
--- thr-posix.c.orig Sat May 5 03:23:21 2001
+++ thr-posix.c
@@ -96,12 +96,17 @@ __objc_thread_detach(void (*func)(void *
int
__objc_thread_set_priority(int priority)
{
+#ifndef _PTH_PTHREAD_H_
pthread_t thread_id = pthread_self();
- int policy;
+ int policy = 0;
struct sched_param params;
int priority_min, priority_max;
+#ifdef __NetBSD__
+ if (pthread_attr_getschedparam(&_objc_thread_attribs, &params) == 0)
+#else
if (pthread_getschedparam(thread_id, &policy, &params) == 0)
+#endif
{
if ((priority_max = sched_get_priority_max(policy)) != 0)
return -1;
@@ -120,9 +125,14 @@ __objc_thread_set_priority(int priority)
* this should be a pointer to policy but pthread.h is universally
* at odds with this.
*/
+#ifdef __NetBSD__
+ if (pthread_attr_setschedparam(&_objc_thread_attribs, &params) == 0)
+#else
if (pthread_setschedparam(thread_id, policy, &params) == 0)
+#endif
return 0;
}
+#endif
return -1;
}
@@ -130,13 +140,24 @@ __objc_thread_set_priority(int priority)
int
__objc_thread_get_priority(void)
{
+#ifdef _PTH_PTHREAD_H_
+ int prio = -1;
+
+ pthread_attr_getprio_np(&_objc_thread_attribs, &prio);
+ return prio;
+#else
int policy;
struct sched_param params;
+#ifdef __NetBSD__
+ if (pthread_attr_getschedparam(&_objc_thread_attribs, &params) == 0)
+#else
if (pthread_getschedparam(pthread_self(), &policy, &params) == 0)
+#endif
return params.sched_priority;
else
return -1;
+#endif
}
/* Yield our process time to another thread. */