VirtualBox

source: kBuild/vendor/grep/current/gnulib-tests/test-pthread.c

Last change on this file was 3529, checked in by bird, 3 years ago

Imported grep 3.7 from grep-3.7.tar.gz (sha256: c22b0cf2d4f6bbe599c902387e8058990e1eee99aef333a203829e5fd3dbb342), applying minimal auto-props.

  • Property svn:eol-style set to native
File size: 2.3 KB
Line 
1/* Test of <pthread.h> substitute.
2 Copyright (C) 2019-2021 Free Software Foundation, Inc.
3
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 3 of the License, or
7 (at your option) any later version.
8
9 This program 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
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <https://www.gnu.org/licenses/>. */
16
17/* Written by Bruno Haible <bruno@clisp.org>, 2019. */
18
19#include <config.h>
20
21#include <pthread.h>
22
23#include "verify.h"
24
25/* Check that the types are all defined. */
26
27pthread_t t1;
28pthread_attr_t t2;
29
30pthread_once_t t3 = PTHREAD_ONCE_INIT;
31
32pthread_mutex_t t4 = PTHREAD_MUTEX_INITIALIZER;
33pthread_mutexattr_t t5;
34
35pthread_rwlock_t t6 = PTHREAD_RWLOCK_INITIALIZER;
36pthread_rwlockattr_t t7;
37
38pthread_cond_t t8 = PTHREAD_COND_INITIALIZER;
39pthread_condattr_t t9;
40
41pthread_key_t t10;
42
43pthread_spinlock_t t11;
44
45#ifdef TODO /* Not implemented in gnulib yet */
46pthread_barrier_t t12;
47pthread_barrierattr_t t13;
48#endif
49
50/* Check that the various macros are defined. */
51
52/* Constants for pthread_attr_setdetachstate(). */
53int ds[] = { PTHREAD_CREATE_JOINABLE, PTHREAD_CREATE_DETACHED };
54
55/* Constants for pthread_exit(). */
56void *canceled = PTHREAD_CANCELED;
57
58/* Constants for pthread_mutexattr_settype(). */
59int mt[] = {
60 PTHREAD_MUTEX_DEFAULT,
61 PTHREAD_MUTEX_NORMAL,
62 PTHREAD_MUTEX_RECURSIVE,
63 PTHREAD_MUTEX_ERRORCHECK
64};
65
66#ifdef TODO /* Not implemented in gnulib yet */
67
68/* Constants for pthread_mutexattr_setrobust(). */
69int mr[] = { PTHREAD_MUTEX_ROBUST, PTHREAD_MUTEX_STALLED };
70
71/* Constants for pthread_barrierattr_setpshared(). */
72int bp[] = { PTHREAD_PROCESS_SHARED, PTHREAD_PROCESS_PRIVATE };
73
74/* Constants for pthread_barrier_wait(). */
75int bw[] = { PTHREAD_BARRIER_SERIAL_THREAD };
76
77/* Constants for pthread_setcancelstate(). */
78int cs[] = { PTHREAD_CANCEL_ENABLE, PTHREAD_CANCEL_DISABLE };
79
80/* Constants for pthread_setcanceltype(). */
81int ct[] = { PTHREAD_CANCEL_DEFERRED, PTHREAD_CANCEL_ASYNCHRONOUS };
82
83#endif
84
85
86int
87main (void)
88{
89 return 0;
90}
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette