pthread5.cc: Include <unistd.h> if _GLIBCPP_HAVE_UNISTD_H is defined.
authorJason Thorpe <thorpej@wasabisystems.com>
Tue, 29 Oct 2002 01:10:52 +0000 (01:10 +0000)
committerJason Thorpe <thorpej@gcc.gnu.org>
Tue, 29 Oct 2002 01:10:52 +0000 (01:10 +0000)
* testsuite/thread/pthread5.cc: Include <unistd.h>
if _GLIBCPP_HAVE_UNISTD_H is defined.
(main): Only use pthread_attr_setscope if
_POSIX_THREAD_PRIORITY_SCHEDULING is defined.

From-SVN: r58608

libstdc++-v3/ChangeLog
libstdc++-v3/testsuite/thread/pthread5.cc

index 690e25ca7b7471405a7a7ec3099d39f94585a558..55b79be1a9aa4ee46d123dbef0460f3ee2f681ef 100644 (file)
@@ -1,3 +1,10 @@
+2002-10-28  Jason Thorpe  <thorpej@wasabisystems.com>
+
+       * testsuite/thread/pthread5.cc: Include <unistd.h>
+       if _GLIBCPP_HAVE_UNISTD_H is defined.
+       (main): Only use pthread_attr_setscope if
+       _POSIX_THREAD_PRIORITY_SCHEDULING is defined.
+
 2002-10-28  Jason Thorpe  <thorpej@wasabisystems.com>
 
        * testsuite/thread/pthread1.cc: Enable on *-*-netbsd*.
index 85d332efe2085359d66a6ea46d4dd533036cd49e..a3987c8876e30d31beac772bcdaeff45008f64b6 100644 (file)
 // configured for the port, then it is picked up free from STL headers.
 
 #if __GTHREADS
+#ifdef _GLIBCPP_HAVE_UNISTD_H
+#include <unistd.h>    // To test for _POSIX_THREAD_PRIORITY_SCHEDULING
+#endif
+
 using namespace std;
 
 #define NTHREADS 8
@@ -97,7 +101,9 @@ main (int argc, char *argv[])
 
   pthread_attr_t tattr;
   int ret = pthread_attr_init (&tattr);
+#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
   ret = pthread_attr_setscope(&tattr, PTHREAD_SCOPE_SYSTEM);
+#endif
 
   for (worker = 0; worker < NTHREADS; worker++)
     {