From b82e29ffe823b80c15a7f80cf38b5bfb42d261b7 Mon Sep 17 00:00:00 2001 From: rmind Date: Sat, 28 Jan 2012 12:23:56 +0000 Subject: [PATCH] tsleep(9) no more. --- tests/rump/kernspace/tsleep.c | 45 ++--------------------------------- 1 file changed, 2 insertions(+), 43 deletions(-) diff --git a/tests/rump/kernspace/tsleep.c b/tests/rump/kernspace/tsleep.c index d4a9e1244a01..8e00349616c9 100644 --- a/tests/rump/kernspace/tsleep.c +++ b/tests/rump/kernspace/tsleep.c @@ -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 #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 @@ -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]); }