tsleep(9) no more.

This commit is contained in:
rmind 2012-01-28 12:23:56 +00:00
parent 9a80847a9f
commit b82e29ffe8

View File

@ -1,4 +1,4 @@
/* $NetBSD: tsleep.c,v 1.2 2011/08/07 14:03:16 rmind Exp $ */
/* $NetBSD: tsleep.c,v 1.3 2012/01/28 12:23:56 rmind Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@ -29,7 +29,7 @@
#include <sys/cdefs.h>
#if !defined(lint)
__RCSID("$NetBSD: tsleep.c,v 1.2 2011/08/07 14:03:16 rmind Exp $");
__RCSID("$NetBSD: tsleep.c,v 1.3 2012/01/28 12:23:56 rmind Exp $");
#endif /* !lint */
#include <sys/param.h>
@ -42,35 +42,6 @@ __RCSID("$NetBSD: tsleep.c,v 1.2 2011/08/07 14:03:16 rmind Exp $");
#define NTHREADS 10
/*
* kernel lock is interlock
*/
static void
bigthread(void *arg)
{
static int wakeups;
struct simplelock slock;
int i;
simple_lock_init(&slock);
for (i = 0; i < 1000; i++) {
wakeup(bigthread);
if (wakeups >= NTHREADS-1)
break;
if (arg) {
simple_lock(&slock);
ltsleep(bigthread, PNORELOCK, "hii", 0, &slock);
} else {
tsleep(bigthread, 0, "hii", 0);
}
}
wakeup(bigthread);
wakeups++;
kthread_exit(0);
}
/*
* mpsafe thread. need dedicated interlock
*/
@ -112,17 +83,9 @@ tinythread(void *arg)
void
rumptest_tsleep()
{
struct lwp *bigl[NTHREADS];
struct lwp *notbigl[NTHREADS];
int rv, i;
for (i = 0; i < NTHREADS; i++) {
rv = kthread_create(PRI_NONE, KTHREAD_MUSTJOIN,
NULL, bigthread, (void *)(uintptr_t)i, &bigl[i], "b");
if (rv)
panic("thread create failed: %d", rv);
}
mutex_init(&mymtx, MUTEX_DEFAULT, IPL_NONE);
for (i = 0; i < NTHREADS; i++) {
@ -132,10 +95,6 @@ rumptest_tsleep()
panic("thread create failed: %d", rv);
}
for (i = 0; i < NTHREADS; i++) {
kthread_join(bigl[i]);
}
for (i = 0; i < NTHREADS; i++) {
kthread_join(notbigl[i]);
}