openat: don’t close (-1)
[gnulib.git] / tests / test-threads-c++.cc
blobf26daea44673f51b92c4aac395357888616efe02
1 /* Test of <threads.h> substitute in C++ mode.
2 Copyright (C) 2019-2024 Free Software Foundation, Inc.
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.
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.
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/>. */
17 /* Written by Bruno Haible <bruno@clisp.org>, 2019. */
19 #define GNULIB_NAMESPACE gnulib
20 #include <config.h>
22 #include <threads.h>
24 #include "signature.h"
27 #if GNULIB_TEST_THRD
28 SIGNATURE_CHECK (GNULIB_NAMESPACE::thrd_create, int,
29 (thrd_t *, thrd_start_t, void *));
30 SIGNATURE_CHECK (GNULIB_NAMESPACE::thrd_current, thrd_t, (void));
31 SIGNATURE_CHECK (GNULIB_NAMESPACE::thrd_equal, int, (thrd_t, thrd_t));
32 SIGNATURE_CHECK (GNULIB_NAMESPACE::thrd_sleep, int,
33 (const struct timespec *, struct timespec *));
34 SIGNATURE_CHECK (GNULIB_NAMESPACE::thrd_yield, void, (void));
35 SIGNATURE_CHECK (GNULIB_NAMESPACE::thrd_detach, int, (thrd_t));
36 SIGNATURE_CHECK (GNULIB_NAMESPACE::thrd_join, int, (thrd_t, int *));
37 SIGNATURE_CHECK (GNULIB_NAMESPACE::thrd_exit, void, (int));
38 #endif
40 #if GNULIB_TEST_MTX
41 SIGNATURE_CHECK (GNULIB_NAMESPACE::mtx_init, int, (mtx_t *, int));
42 SIGNATURE_CHECK (GNULIB_NAMESPACE::mtx_lock, int, (mtx_t *));
43 SIGNATURE_CHECK (GNULIB_NAMESPACE::mtx_trylock, int, (mtx_t *));
44 SIGNATURE_CHECK (GNULIB_NAMESPACE::mtx_timedlock, int,
45 (mtx_t *, const struct timespec *));
46 SIGNATURE_CHECK (GNULIB_NAMESPACE::mtx_unlock, int, (mtx_t *));
47 SIGNATURE_CHECK (GNULIB_NAMESPACE::mtx_destroy, void, (mtx_t *));
48 #endif
50 #if GNULIB_TEST_CALL_ONCE
51 SIGNATURE_CHECK (GNULIB_NAMESPACE::call_once, void,
52 (once_flag *, void (*) (void)));
53 #endif
55 #if GNULIB_TEST_CND
56 SIGNATURE_CHECK (GNULIB_NAMESPACE::cnd_init, int, (cnd_t *));
57 SIGNATURE_CHECK (GNULIB_NAMESPACE::cnd_wait, int, (cnd_t *, mtx_t *));
58 SIGNATURE_CHECK (GNULIB_NAMESPACE::cnd_timedwait, int,
59 (cnd_t *, mtx_t *, const struct timespec *));
60 SIGNATURE_CHECK (GNULIB_NAMESPACE::cnd_signal, int, (cnd_t *));
61 SIGNATURE_CHECK (GNULIB_NAMESPACE::cnd_broadcast, int, (cnd_t *));
62 SIGNATURE_CHECK (GNULIB_NAMESPACE::cnd_destroy, void, (cnd_t *));
63 #endif
65 #if GNULIB_TEST_TSS
66 SIGNATURE_CHECK (GNULIB_NAMESPACE::tss_create, int, (tss_t *, tss_dtor_t));
67 SIGNATURE_CHECK (GNULIB_NAMESPACE::tss_set, int, (tss_t, void *));
68 SIGNATURE_CHECK (GNULIB_NAMESPACE::tss_get, void *, (tss_t));
69 SIGNATURE_CHECK (GNULIB_NAMESPACE::tss_delete, void, (tss_t));
70 #endif
73 int
74 main ()