This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.
Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
Hi!
*(pthread_t *) arg points to a variable (me) on initial thread's stack.
If tf returns from pthread_barrier_wait after do_test returns from
pthread_barrier_wait and runs all the code until return from routine,
*mtp in tf reads garbage.
The patch below ensures that the handle is read from initial thread's
stack before pthread_barrier_wait, so the routine certainly did not return
yet.
Alternatively me variable in do_test would need to be static, or
it would need to pass pthread_t, not pthread_t *.
2004-08-11 Jakub Jelinek <jakub@redhat.com>
* tst-rwlock14.c (tf): Read main thread handle from *arg
before pthread_barrier_wait.
--- libc/nptl/tst-rwlock14.c.jj 2004-08-11 15:20:06.504152481 +0200
+++ libc/nptl/tst-rwlock14.c 2004-08-11 15:26:34.056471560 +0200
@@ -38,12 +38,12 @@ tf (void *arg)
exit (EXIT_FAILURE);
}
- pthread_barrier_wait (&b);
+ pthread_t mt = *(pthread_t *) arg;
- pthread_t *mtp = (pthread_t *) arg;
+ pthread_barrier_wait (&b);
/* This call will never return. */
- pthread_join (*mtp, NULL);
+ pthread_join (mt, NULL);
return NULL;
}
Jakub
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |