-/* Copyright (C) 2002 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+#include <errno.h>
#include <pthread.h>
#include <semaphore.h>
#include <signal.h>
#include <unistd.h>
-/* Number of different signalss to use. Also is the number of
- threads. */
-#define N 10
+#ifdef SIGRTMIN
+
+/* Number of different signals to use. Also is the number of threads. */
+# define N 10
/* Maximum number of threads in flight at any one time. */
-#define INFLIGHT 5
+# define INFLIGHT 5
/* Number of signals sent in total. */
-#define ROUNDS 10000
+# define ROUNDS 10000
static int received[N][N];
exit (1);
}
+ pthread_attr_t a;
+
+ if (pthread_attr_init (&a) != 0)
+ {
+ puts ("attr_init failed");
+ exit (1);
+ }
+
+ if (pthread_attr_setstacksize (&a, 1 * 1024 * 1024) != 0)
+ {
+ puts ("attr_setstacksize failed");
+ return 1;
+ }
+
for (i = 0; i < N; ++i)
{
if (pthread_mutex_init (&lock[i], NULL) != 0)
printf ("mutex_lock[%d] failed\n", i);
}
- if (pthread_create (&th[i], NULL, tf, (void *) (long int) i) != 0)
+ if (pthread_create (&th[i], &a, tf, (void *) (long int) i) != 0)
{
printf ("create of thread %d failed\n", i);
exit (1);
}
}
+ if (pthread_attr_destroy (&a) != 0)
+ {
+ puts ("attr_destroy failed");
+ exit (1);
+ }
+
int result = 0;
unsigned int r = 42;
pid_t pid = getpid ();
for (i = 0; i < ROUNDS; ++i)
{
- if (sem_wait (&sem) != 0)
+ if (TEMP_FAILURE_RETRY (sem_wait (&sem)) != 0)
{
printf ("sem_wait round %d failed: %m\n", i);
exit (1);
return result;
}
-#define TIMEOUT 10
-#define TEST_FUNCTION do_test ()
+# define TEST_FUNCTION do_test ()
+
+#else
+# define TEST_FUNCTION 0
+#endif
+
#include "../test-skeleton.c"