Linux: use reserved name __key in pkey_get [BZ #22797]
[glibc.git] / nptl / test-cond-printers.c
blob4a416cd5be983ead31099b36a0cb7779c2a3ba4b
1 /* Helper program for testing the pthread_cond_t pretty printer.
3 Copyright (C) 2016-2018 Free Software Foundation, Inc.
4 This file is part of the GNU C Library.
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; if not, see
18 <http://www.gnu.org/licenses/>. */
20 /* Keep the calls to the pthread_* functions on separate lines to make it easy
21 to advance through the program using the gdb 'next' command. */
23 #include <time.h>
24 #include <pthread.h>
26 #define PASS 0
27 #define FAIL 1
29 static int test_status_destroyed (pthread_cond_t *condvar);
31 int
32 main (void)
34 pthread_cond_t condvar;
35 pthread_condattr_t attr;
36 int result = FAIL;
38 if (pthread_condattr_init (&attr) == 0
39 && test_status_destroyed (&condvar) == PASS)
40 result = PASS;
41 /* Else, one of the pthread_cond* functions failed. */
43 return result;
46 /* Initializes CONDVAR, then destroys it. */
47 static int
48 test_status_destroyed (pthread_cond_t *condvar)
50 int result = FAIL;
52 if (pthread_cond_init (condvar, NULL) == 0
53 && pthread_cond_destroy (condvar) == 0)
54 result = PASS; /* Test status (destroyed). */
56 return result;