gthr-posix.h: Check for _POSIX_PRIORITY_SCHEDULING when checking for...
authorAndrew Pinski <pinskia@gcc.gnu.org>
Fri, 28 May 2004 20:18:23 +0000 (13:18 -0700)
committerAndrew Pinski <pinskia@gcc.gnu.org>
Fri, 28 May 2004 20:18:23 +0000 (13:18 -0700)
2004-05-28  Andrew Pinski  <pinskia@physics.uc.edu>

        * gthr-posix.h: Check for _POSIX_PRIORITY_SCHEDULING
        when checking for _POSIX_THREAD_PRIORITY_SCHEDULING.
        Remove comment about not checking for
        _POSIX_PRIORITY_SCHEDULING.
        * gthr-posix.c: Likewise.

From-SVN: r82376

gcc/gthr-posix.c
gcc/gthr-posix.h

index 56bbad2830111103f09754c18450596e0df8bad5..b1a2e3145699864ddf6f67d60fa046f8f6cd64e3 100644 (file)
@@ -147,7 +147,7 @@ pthread_self (void)
 {
   return (pthread_t) 0;
 }
-
+#ifdef _POSIX_PRIORITY_SCHEDULING
 #ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
 int
 sched_get_priority_max (int policy ATTRIBUTE_UNUSED)
@@ -161,6 +161,7 @@ sched_get_priority_min (int policy ATTRIBUTE_UNUSED)
   return 0;
 }
 #endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
+#endif /* _POSIX_PRIORITY_SCHEDULING */
 
 int
 sched_yield (void)
index 88234daae93a60d133c06c6304e29c1f3c1e4a28..e2b5a5739990ccc6cb2fc1569088b87702170230 100644 (file)
@@ -74,12 +74,12 @@ typedef pthread_mutex_t __gthread_mutex_t;
 #pragma weak pthread_mutex_init
 #pragma weak pthread_mutex_destroy
 #pragma weak pthread_self
-/* These really should be protected by _POSIX_PRIORITY_SCHEDULING, but
-   we use them inside a _POSIX_THREAD_PRIORITY_SCHEDULING block.  */
+#ifdef _POSIX_PRIORITY_SCHEDULING
 #ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
 #pragma weak sched_get_priority_max
 #pragma weak sched_get_priority_min
 #endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
+#endif /* _POSIX_PRIORITY_SCHEDULING */
 #pragma weak sched_yield
 #pragma weak pthread_attr_destroy
 #pragma weak pthread_attr_init
@@ -187,6 +187,7 @@ __gthread_objc_thread_set_priority (int priority)
     return -1;
   else
     {
+#ifdef _POSIX_PRIORITY_SCHEDULING
 #ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
       pthread_t thread_id = pthread_self ();
       int policy;
@@ -216,6 +217,7 @@ __gthread_objc_thread_set_priority (int priority)
            return 0;
        }
 #endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
+#endif /* _POSIX_PRIORITY_SCHEDULING */
       return -1;
     }
 }
@@ -224,6 +226,7 @@ __gthread_objc_thread_set_priority (int priority)
 static inline int
 __gthread_objc_thread_get_priority (void)
 {
+#ifdef _POSIX_PRIORITY_SCHEDULING
 #ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
   if (__gthread_active_p ())
     {
@@ -237,6 +240,7 @@ __gthread_objc_thread_get_priority (void)
     }
   else
 #endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
+#endif /* _POSIX_PRIORITY_SCHEDULING */
     return OBJC_THREAD_INTERACTIVE_PRIORITY;
 }