]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - nptl/tst-cond18.c
Prefer https to http for gnu.org and fsf.org URLs
[thirdparty/glibc.git] / nptl / tst-cond18.c
index 8d77025d792877d66c2057de585f8ccb70007766..033770ea2badef376cd8aa1e360b735c67525e72 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2004-2017 Free Software Foundation, Inc.
+/* Copyright (C) 2004-2019 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jakub Jelinek <jakub@redhat.com>, 2004.
 
 
    You should have received a copy of the GNU Lesser General Public
    License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
+   <https://www.gnu.org/licenses/>.  */
 
 #include <errno.h>
+#include <limits.h>
 #include <fcntl.h>
 #include <pthread.h>
 #include <stdbool.h>
@@ -27,7 +28,8 @@
 pthread_cond_t cv = PTHREAD_COND_INITIALIZER;
 pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
 bool exiting;
-int fd, count, spins, nn;
+int fd, spins, nn;
+enum { count = 8 };            /* Number of worker threads.  */
 
 void *
 tf (void *id)
@@ -81,16 +83,11 @@ do_test (void)
       return 1;
     }
 
-  count = sysconf (_SC_NPROCESSORS_ONLN);
-  if (count <= 0)
-    count = 1;
-  count *= 8;
-
   pthread_t th[count + 1];
   pthread_attr_t attr;
   int i, ret, sz;
   pthread_attr_init (&attr);
-  sz = __getpagesize ();
+  sz = sysconf (_SC_PAGESIZE);
   if (sz < PTHREAD_STACK_MIN)
          sz = PTHREAD_STACK_MIN;
   pthread_attr_setstacksize (&attr, sz);