aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.threads/tls.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2010-09-14 19:08:30 +0000
committerTom Tromey <tromey@redhat.com>2010-09-14 19:08:30 +0000
commit515ed532307e751b26e34347ee7258f164eb053f (patch)
tree2f6764bb18b314dcceabbd40073a729536d47eaa /gdb/testsuite/gdb.threads/tls.c
parent7ef07ba077cec6568e767adefb995ffbc89970c0 (diff)
downloadgdb-515ed532307e751b26e34347ee7258f164eb053f.zip
gdb-515ed532307e751b26e34347ee7258f164eb053f.tar.gz
gdb-515ed532307e751b26e34347ee7258f164eb053f.tar.bz2
gdb
PR exp/11803: * value.c (value_static_field): Use value_of_variable. gdb/testsuite PR exp/11803: * gdb.threads/tls.exp: Use C++. (check_thread_local): Use K::another_thread_local. * gdb.threads/tls.c (class K): New. (another_thread_local): Now a member of K. (spin): Update. No longer K&R C.
Diffstat (limited to 'gdb/testsuite/gdb.threads/tls.c')
-rw-r--r--gdb/testsuite/gdb.threads/tls.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/gdb/testsuite/gdb.threads/tls.c b/gdb/testsuite/gdb.threads/tls.c
index 8f2443c..9a87e91 100644
--- a/gdb/testsuite/gdb.threads/tls.c
+++ b/gdb/testsuite/gdb.threads/tls.c
@@ -18,7 +18,13 @@
/* Thread-local storage. */
__thread int a_thread_local;
-__thread int another_thread_local;
+
+class K {
+ public:
+ static __thread int another_thread_local;
+};
+
+__thread int K::another_thread_local;
/* psymtabs->symtabs resolving check. */
extern __thread int file2_thread_local;
@@ -64,8 +70,7 @@ void print_error ()
}
/* Routine for each thread to run, does nothing. */
-void *spin( vp )
- void * vp;
+void *spin( void *vp )
{
int me = (long) vp;
int i;
@@ -74,19 +79,19 @@ void *spin( vp )
a_global++;
a_thread_local = 0;
- another_thread_local = me;
+ K::another_thread_local = me;
for( i = 0; i <= me; i++ ) {
a_thread_local += i;
}
- another_thread_local_val[me] = another_thread_local;
+ another_thread_local_val[me] = K::another_thread_local;
thread_local_val[ me ] = a_thread_local; /* here we know tls value */
if (sem_post (&tell_main) == -1)
{
fprintf (stderr, "th %d post on sem tell_main failed\n", me);
print_error ();
- return;
+ return NULL;
}
#ifdef START_DEBUG
fprintf (stderr, "th %d post on tell main\n", me);
@@ -111,7 +116,7 @@ void *spin( vp )
{
fprintf (stderr, "th %d wait on sem tell_thread failed\n", me);
print_error ();
- return;
+ return NULL;
}
}
@@ -119,6 +124,7 @@ void *spin( vp )
fprintf (stderr, "th %d Wait on tell_thread\n", me);
#endif
+ return NULL;
}
void