Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/rump/kernspace tsleep(9) no more.



details:   https://anonhg.NetBSD.org/src/rev/99b6d81962b3
branches:  trunk
changeset: 773124:99b6d81962b3
user:      rmind <rmind%NetBSD.org@localhost>
date:      Sat Jan 28 12:23:56 2012 +0000

description:
tsleep(9) no more.

diffstat:

 tests/rump/kernspace/tsleep.c |  45 +-----------------------------------------
 1 files changed, 2 insertions(+), 43 deletions(-)

diffs (83 lines):

diff -r 42ccdea305ff -r 99b6d81962b3 tests/rump/kernspace/tsleep.c
--- a/tests/rump/kernspace/tsleep.c     Sat Jan 28 12:22:33 2012 +0000
+++ b/tests/rump/kernspace/tsleep.c     Sat Jan 28 12:23:56 2012 +0000
@@ -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>
@@ -43,35 +43,6 @@
 #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
  */
 static kmutex_t mymtx;
@@ -112,17 +83,9 @@
 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++) {
@@ -133,10 +96,6 @@
        }
 
        for (i = 0; i < NTHREADS; i++) {
-               kthread_join(bigl[i]);
-       }
-
-       for (i = 0; i < NTHREADS; i++) {
                kthread_join(notbigl[i]);
        }
 }



Home | Main Index | Thread Index | Old Index