Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/nathanw_sa]: src/lib/libpthread Create more idle threads. In the current...
details: https://anonhg.NetBSD.org/src/rev/fc415866569d
branches: nathanw_sa
changeset: 504863:fc415866569d
user: nathanw <nathanw%NetBSD.org@localhost>
date: Tue Jul 17 20:18:39 2001 +0000
description:
Create more idle threads. In the current system, we need one for every level
of preemption nesting.
diffstat:
lib/libpthread/pthread.c | 20 +++++++++++---------
lib/libpthread/pthread_int.h | 3 ++-
2 files changed, 13 insertions(+), 10 deletions(-)
diffs (58 lines):
diff -r 91e4e2b1f7cb -r fc415866569d lib/libpthread/pthread.c
--- a/lib/libpthread/pthread.c Tue Jul 17 20:13:55 2001 +0000
+++ b/lib/libpthread/pthread.c Tue Jul 17 20:18:39 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pthread.c,v 1.1.2.3 2001/07/13 02:42:38 nathanw Exp $ */
+/* $NetBSD: pthread.c,v 1.1.2.4 2001/07/17 20:18:39 nathanw Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -79,7 +79,7 @@
pthread__start(void)
{
pthread_t first, idle;
- int ret;
+ int i, ret;
/* Basic data structure setup */
pthread_attr_init(&pthread_default_attr);
@@ -95,13 +95,15 @@
sigprocmask(0, NULL, &first->pt_sigmask);
PTQ_INSERT_HEAD(&allqueue, first, pt_allq);
- /* Create idle threads */
- ret = pthread__stackalloc(&idle);
- if (ret != 0)
- err(1, "Couldn't allocate stack for idle thread!");
- pthread__initthread(idle);
- PTQ_INSERT_HEAD(&allqueue, idle, pt_allq);
- pthread__sched_idle(first, idle);
+ for (i = 0; i < NIDLETHREADS; i++) {
+ /* Create idle threads */
+ ret = pthread__stackalloc(&idle);
+ if (ret != 0)
+ err(1, "Couldn't allocate stack for idle thread!");
+ pthread__initthread(idle);
+ PTQ_INSERT_HEAD(&allqueue, idle, pt_allq);
+ pthread__sched_idle(first, idle);
+ }
/* Start up the SA subsystem */
pthread__sa_start();
diff -r 91e4e2b1f7cb -r fc415866569d lib/libpthread/pthread_int.h
--- a/lib/libpthread/pthread_int.h Tue Jul 17 20:13:55 2001 +0000
+++ b/lib/libpthread/pthread_int.h Tue Jul 17 20:18:39 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pthread_int.h,v 1.1.2.4 2001/07/13 02:42:38 nathanw Exp $ */
+/* $NetBSD: pthread_int.h,v 1.1.2.5 2001/07/17 20:18:39 nathanw Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -136,6 +136,7 @@
#define PT_UPCALLSTACKS 16
+#define NIDLETHREADS 4
#define IDLESPINS 1000
/* Utility functions */
Home |
Main Index |
Thread Index |
Old Index