]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - nptl/tst-clock2.c
Add per-thread cache to malloc
[thirdparty/glibc.git] / nptl / tst-clock2.c
index 54f5041282805f6bd652956364dc23d29f7601df..aa946efd2695d953933c267c67fa3b7d466cae8e 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2003-2017 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
 
@@ -13,9 +13,8 @@
    Lesser General Public License for more details.
 
    You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
 
 #include <errno.h>
 #include <pthread.h>
@@ -25,7 +24,7 @@
 #include <unistd.h>
 
 
-#if _POSIX_THREAD_CPUTIME
+#if defined _POSIX_THREAD_CPUTIME && _POSIX_THREAD_CPUTIME >= 0
 static pthread_barrier_t b2;
 static pthread_barrier_t bN;
 
@@ -55,9 +54,17 @@ tf (void *arg)
 int
 do_test (void)
 {
-#if _POSIX_THREAD_CPUTIME
+#if defined _POSIX_THREAD_CPUTIME && _POSIX_THREAD_CPUTIME >= 0
 # define N 10
 
+# if _POSIX_THREAD_CPUTIME == 0
+  if (sysconf (_SC_THREAD_CPUTIME) < 0)
+    {
+      puts ("_POSIX_THREAD_CPUTIME option not available");
+      return 0;
+    }
+# endif
+
   if (pthread_barrier_init (&b2, NULL, 2) != 0
       || pthread_barrier_init (&bN, NULL, N + 1) != 0)
     {