1 /* Test that gettext() in multithreaded applications works correctly.
2 Copyright (C) 2008-2023 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
32 pthread_barrier_wait (&b
);
33 return gettext ("Operation not permitted");
40 unsetenv ("LANGUAGE");
41 unsetenv ("OUTPUT_CHARSET");
42 textdomain ("tstgettext6");
43 bindtextdomain ("tstgettext6", OBJPFX
"domaindir");
44 setlocale (LC_ALL
, "ja_JP.UTF-8");
45 pthread_barrier_init (&b
, NULL
, 4);
46 for (int i
= 0; i
< 4; i
++)
47 if (pthread_create (&th
[i
], NULL
, tf
, NULL
))
49 puts ("pthread_create failed");
52 for (int i
= 0; i
< 4; i
++)
53 pthread_join (th
[i
], NULL
);
60 for (int i
= 0; i
< 300; i
++)
65 printf ("fork failed: %m\n");
72 if (WIFEXITED (status
) && WEXITSTATUS (status
) != 0)
74 printf ("child exited with %d\n", WEXITSTATUS (status
));
77 else if (WIFSIGNALED (status
))
79 printf ("child killed by signal %d\n", WTERMSIG (status
));