Subject: lib/24241: pthread_rwlock_timedwrlock assertion failure
To: None <gnats-bugs@gnats.netbsd.org>
From: None <yamt@mwd.biglobe.ne.jp>
List: netbsd-bugs
Date: 01/26/2004 08:15:26
>Number:         24241
>Category:       lib
>Synopsis:       pthread_rwlock_timedwrlock assertion failure
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jan 25 23:16:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
>Release:        NetBSD 1.6ZH
>Organization:

>Environment:
	
	
System: NetBSD kaeru 1.6ZH NetBSD 1.6ZH (build.kaeru) #792: Sun Jan 25 18:03:43 JST 2004 takashi@kaeru:/usr/home/takashi/work/kernel/build.kaeru i386
Architecture: i386
Machine: i386
>Description:
	using rwlock without starting any thread causes the following
	assertion failure.

	assertion "retval == 0" failed: file "pthread_alarms.c", line 105, function "pthread__alarm_add"

>How-To-Repeat:


#include <errno.h>
#include <pthread.h>
#include <stdlib.h>

pthread_rwlock_t lk;

struct timespec to = {1, 0};

int main(void);

int
main()
{
	int error;

	error = pthread_rwlock_init(&lk, NULL);
	if (error)
		exit(1);

	error = pthread_rwlock_rdlock(&lk);
	if (error)
		exit(2);

	error = pthread_rwlock_timedwrlock(&lk, &to);
	if (error != ETIMEDOUT)
		exit(5);

	exit(0);
}

>Fix:
	implement 'nothread' version?

>Release-Note:
>Audit-Trail:
>Unformatted: