diff options
author | Austin Foxley <austinf@cetoncorp.com> | 2009-11-29 20:18:05 -0800 |
---|---|---|
committer | Austin Foxley <austinf@cetoncorp.com> | 2009-11-29 20:18:05 -0800 |
commit | c77069f8cf411096ea633b567db77f90ca3ed761 (patch) | |
tree | 6cb4f415ce2f1596252945d96fae7f1087f3df7f /test/nptl/tst-tls3mod.c | |
parent | 4d91ad3daa7260427e96ce1d6c62962795c9dbd5 (diff) |
test/nptl: rework tst-tls3 to link with -z,now
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
Diffstat (limited to 'test/nptl/tst-tls3mod.c')
-rw-r--r-- | test/nptl/tst-tls3mod.c | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/test/nptl/tst-tls3mod.c b/test/nptl/tst-tls3mod.c index 25f892405..53206d30d 100644 --- a/test/nptl/tst-tls3mod.c +++ b/test/nptl/tst-tls3mod.c @@ -29,13 +29,12 @@ #if HAVE___THREAD -extern pthread_barrier_t b; +static pthread_barrier_t* b = NULL; #define TOTAL_SIGS 1000 -extern int nsigs; - -extern sem_t s; +static int* nsigs = NULL; +static sem_t* s = NULL; static __thread void (*fp) (void); @@ -52,17 +51,30 @@ handler (int sig) fp (); - if (sem_post (&s) != 0) + if (sem_post (s) != 0) { write (STDOUT_FILENO, "sem_post failed\n", 16); _exit (1); } } +void +setup_tf (pthread_barrier_t* t_b, int* t_nsigs, sem_t* t_s) +{ + b = t_b; + nsigs = t_nsigs; + s = t_s; +} void * tf (void *arg) { + if (!b || !s || !nsigs) + { + puts ("need to call setup_tf first"); + exit (1); + } + if ((uintptr_t) pthread_self () & (TCB_ALIGNMENT - 1)) { puts ("thread's struct pthread not aligned enough"); @@ -71,18 +83,18 @@ tf (void *arg) if (fp != NULL) { -printf("fp=%p\n", (void *)&fp); + printf("fp=%p\n", (void *)&fp); puts ("fp not initially NULL"); exit (1); } fp = arg; - pthread_barrier_wait (&b); + pthread_barrier_wait (b); - pthread_barrier_wait (&b); + pthread_barrier_wait (b); - if (nsigs != TOTAL_SIGS) + if (*nsigs != TOTAL_SIGS) { puts ("barrier_wait prematurely returns"); exit (1); |