x86-64: Don't use SSE resolvers for ISA level 3 or above
[glibc.git] / sysdeps / pthread / tst-cond19.c
blob9b42f34e6952d143efc9bef3773e16ea7538b653
1 /* Copyright (C) 2004-2024 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <https://www.gnu.org/licenses/>. */
18 #include <errno.h>
19 #include <pthread.h>
20 #include <stdio.h>
21 #include <stdlib.h>
22 #include <time.h>
25 static pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
26 static pthread_mutex_t mut = PTHREAD_MUTEX_INITIALIZER;
29 static int
30 do_test (void)
32 int result = 0;
33 struct timespec ts;
35 if (clock_gettime (CLOCK_REALTIME, &ts) != 0)
37 puts ("clock_gettime failed");
38 return 1;
41 ts.tv_nsec = -1;
43 int e = pthread_cond_timedwait (&cond, &mut, &ts);
44 if (e == 0)
46 puts ("first cond_timedwait did not fail");
47 result = 1;
49 else if (e != EINVAL)
51 puts ("first cond_timedwait did not return EINVAL");
52 result = 1;
55 ts.tv_nsec = 2000000000;
57 e = pthread_cond_timedwait (&cond, &mut, &ts);
58 if (e == 0)
60 puts ("second cond_timedwait did not fail");
61 result = 1;
63 else if (e != EINVAL)
65 puts ("second cond_timedwait did not return EINVAL");
66 result = 1;
69 return result;
73 #define TEST_FUNCTION do_test ()
74 #include "../test-skeleton.c"