[kaffe] CVS kaffe (dalibor): Fix for pthreads on OpenBSD

Kaffe CVS Kaffe Mailing List <kaffe@kaffe.org>
Mon Mar 22 07:57:02 2004


PatchSet 4559 
Date: 2004/03/22 15:14:28
Author: dalibor
Branch: HEAD
Tag: (none) 
Log:
Fix for pthreads on OpenBSD

2004-03-22  Dalibor Topic <robilad@kaffe.org>

        * kaffe/kaffevm/systems/unix-pthreads/thread-impl.c
        (tMapPriorities): Only use sched_get_priority_min|max
        if they are available on the platform.

Members: 
	ChangeLog:1.2137->1.2138 
	kaffe/kaffevm/systems/unix-pthreads/thread-impl.c:1.22->1.23 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.2137 kaffe/ChangeLog:1.2138
--- kaffe/ChangeLog:1.2137	Mon Mar 22 14:49:15 2004
+++ kaffe/ChangeLog	Mon Mar 22 15:14:28 2004
@@ -1,5 +1,11 @@
 2004-03-22  Dalibor Topic <robilad@kaffe.org>
 
+	* kaffe/kaffevm/systems/unix-pthreads/thread-impl.c
+	(tMapPriorities): Only use sched_get_priority_min|max
+	if they are available on the platform.
+
+2004-03-22  Dalibor Topic <robilad@kaffe.org>
+
         * configure.in:
 	Check for sched_get_priority_max and
 	sched_get_priority_min. They are unimplemented on
Index: kaffe/kaffe/kaffevm/systems/unix-pthreads/thread-impl.c
diff -u kaffe/kaffe/kaffevm/systems/unix-pthreads/thread-impl.c:1.22 kaffe/kaffe/kaffevm/systems/unix-pthreads/thread-impl.c:1.23
--- kaffe/kaffe/kaffevm/systems/unix-pthreads/thread-impl.c:1.22	Mon Mar 22 12:03:23 2004
+++ kaffe/kaffe/kaffevm/systems/unix-pthreads/thread-impl.c	Mon Mar 22 15:14:30 2004
@@ -350,11 +350,20 @@
 static
 void tMapPriorities (int npr)
 {
-  int     d, min, max, i;
+  int     d, max, min, i;
   float   r;
 
+#if defined(HAVE_SCHED_GET_PRIORITY_MIN)
   min = sched_get_priority_min( SCHEDULE_POLICY);
+#else
+  min = 0;
+#endif /* defined(HAVE_SCHED_GET_PRIORITY_MIN) */
+
+#if defined(HAVE_SCHED_GET_PRIORITY_MAX)
   max = sched_get_priority_max( SCHEDULE_POLICY);
+#else
+  max = 0;
+#endif /* defined(HAVE_SCHED_GET_PRIORITY_MAX) */
 
   d = max - min;
   r = (float)d / (float)npr;