Subject: port-amd64/24926: pthread problem
To: None <gnats-bugs@gnats.netbsd.org>
From: None <kristerw@netbsd.org>
List: netbsd-bugs
Date: 03/26/2004 17:24:31
>Number: 24926
>Category: port-amd64
>Synopsis: pthread problem
>Confidential: no
>Severity: critical
>Priority: medium
>Responsible: port-amd64-maintainer
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Mar 26 17:25:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator: Krister Walfridsson
>Release: NetBSD 1.6ZL (Compiled from Mar 26 source.)
>Organization:
>Environment:
System: NetBSD amd64.kwa 1.6ZL NetBSD 1.6ZL (GENERIC) #0: Fri Mar 26 14:03:58 CET 2004 cato@amd64.kwa:/home/cato/nbsd040326/obj.amd64/sys/arch/amd64/compile/GENERIC amd64
>Description:
The configure script for the package mail/milter-greylist hangs on amd64
when it is "checking for broken rwlock in libpthread".
>How-To-Repeat:
Compile the test program below with
gcc bug.c -pthread
and notice that running
./a.out
never returns.
#include <stdlib.h>
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
#include <pthread.h>
pthread_rwlock_t lock;
void testfunc();
void yeild(void);
void yield (void)
{
struct timeval tv;
tv.tv_sec = 1;
tv.tv_usec = 0;
if (select(0, NULL, NULL, NULL, &tv) != 0)
exit(EXIT_FAILURE);
}
void testfunc (dontcare) void *dontcare;
{
if (pthread_rwlock_rdlock(&lock) != 0)
exit(EXIT_FAILURE);
yield();
if (pthread_rwlock_unlock(&lock) != 0)
exit(EXIT_FAILURE);
}
int
main ()
{
pthread_t tid;
if (pthread_rwlock_init(&lock, NULL) != 0)
exit(EXIT_FAILURE);
if (pthread_create(&tid, NULL, (void *)testfunc, NULL) != 0)
exit(EXIT_FAILURE);
if (pthread_rwlock_rdlock(&lock) != 0)
exit(EXIT_FAILURE);
yield();
if (pthread_rwlock_unlock(&lock) != 0)
exit(EXIT_FAILURE);
if (pthread_join(tid, NULL) != 0)
exit(EXIT_FAILURE);
return 0;
}
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: