[Patch]: SIGSEGV: exceptions with thread specific data
H.J. Lu
hjl@varesearch.com
Tue Mar 16 14:05:00 GMT 1999
> glibc's malloc is most definitely thread-safe, as long as it
> is properly initialized. Do the malloc() requests for exception
> handling happen very early, maybe even before glibc's constructors
> have run ?
>
> I'll have more time to look into this later this week. If someone
> can send me the latest test-case, I'd be grateful
>
>
Here it is.
--
H.J. Lu (hjl@gnu.org)
---
----
#include <pthread.h>
#include <stdlib.h>
#include <stdio.h>
char *ptr;
pthread_key_t key;
void *main_thr(void * x)
{
int i;
// here linuxthreads allocate through calloc thread specific data
pthread_setspecific(key, "asd");// try move after catch
ptr = malloc (300);
pthread_setspecific(key, NULL);
}
int
main()
{
pthread_t t_id;
pthread_key_create(&key, NULL);
pthread_create(&t_id, NULL, main_thr, NULL);
pthread_join(t_id, NULL);
pthread_key_delete(key); // try disable
free (ptr);
exit(0);
}
More information about the Libc-hacker
mailing list