This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
pthread detach problem with glibc 2.2 on SMP
- To: libc-alpha Mailinglist <libc-alpha at sourceware dot cygnus dot com>
- Subject: pthread detach problem with glibc 2.2 on SMP
- From: Andreas Jaeger <aj at suse dot de>
- Date: 06 Dec 2000 09:01:09 +0100
- Cc: Ruediger Oertel <ro at suse dot de>
The following program compiled with:
gcc -o pthread-test -g -O2 pthread-test.c -lpthread -Wall
gives sometimes (try it at least 20 times) on an SMP system as result:
abc: Interrupted system call
def: Invalid argument
with an exit status of 15. I'm running glibc 2.2 here.
Has anybody an idea how to fix this?
Thanks,
Andreas
#include <pthread.h>
#include <stdio.h>
static void *
task (void *p)
{
return (void *) (p == NULL);
}
int
main (void)
{
pthread_t t;
int status;
/* make sure pthread_create() isn't just a stub */
status = 0;
status = pthread_create (&t, NULL, task, NULL);
if (status)
{
perror ("foo");
exit (status * 3);
}
/* make sure pthread_detach() isn't just a stub */
status = pthread_detach (t) * 5;
if (status)
perror ("abc");
pthread_kill_other_threads_np ();
if (status)
perror ("def");
exit (status);
return 0;
}
--
Andreas Jaeger
SuSE Labs aj@suse.de
private aj@arthur.inka.de
http://www.suse.de/~aj