/* This test program is part of GDB, The GNU debugger.
- Copyright 2004-2014 Free Software Foundation, Inc.
+ Copyright 2004-2017 Free Software Foundation, Inc.
Originally written by Jeff Johnston <jjohnstn@redhat.com>,
contributed by Red Hat
sem_t semaphore;
+#ifdef HAVE_TLS
+__thread int tlsvar;
+#endif
+
void *
thread_function (void *arg)
{
- printf ("Thread executing\n");
+#ifdef HAVE_TLS
+ tlsvar = 2;
+#endif
while (sem_wait (&semaphore) != 0)
{
if (errno != EINTR)
{
perror ("thread_function");
- return;
+ return NULL;
}
}
+ printf ("Thread executing\n"); /* tlsvar-is-set */
return NULL;
}
return -1;
}
+#ifdef HAVE_TLS
+ tlsvar = 1;
+#endif
/* Create a thread, wait for it to complete. */
{