summaryrefslogtreecommitdiff
path: root/libports/manage-multithread.c
diff options
context:
space:
mode:
Diffstat (limited to 'libports/manage-multithread.c')
-rw-r--r--libports/manage-multithread.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/libports/manage-multithread.c b/libports/manage-multithread.c
index 2f3f344f..82fa2ac6 100644
--- a/libports/manage-multithread.c
+++ b/libports/manage-multithread.c
@@ -1,5 +1,5 @@
/*
- Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
Written by Michael I. Bushnell.
This file is part of the GNU Hurd.
@@ -29,8 +29,7 @@ ports_manage_port_operations_multithread (struct port_bucket *bucket,
ports_demuxer_type demuxer,
int thread_timeout,
int global_timeout,
- int wire_cthreads,
- mach_port_t wire_threads)
+ void (*hook)())
{
volatile int nreqthreads;
volatile int totalthreads;
@@ -61,6 +60,7 @@ ports_manage_port_operations_multithread (struct port_bucket *bucket,
assert (nreqthreads);
nreqthreads--;
if (nreqthreads == 0)
+ /* No thread would be listening for requests, spawn one. */
spawn = 1;
spin_unlock (&lock);
@@ -123,10 +123,8 @@ ports_manage_port_operations_multithread (struct port_bucket *bucket,
int timeout;
error_t err;
- if (wire_threads)
- thread_wire (wire_threads, hurd_thread_self (), 1);
- if (wire_cthreads)
- cthread_wire ();
+ if (hook)
+ (*hook) ();
if (master)
timeout = global_timeout;
@@ -153,6 +151,12 @@ ports_manage_port_operations_multithread (struct port_bucket *bucket,
else
{
spin_lock (&lock);
+ if (nreqthreads == 1)
+ {
+ /* No other thread is listening for requests, continue. */
+ spin_unlock (&lock);
+ goto startover;
+ }
nreqthreads--;
totalthreads--;
spin_unlock (&lock);
@@ -160,12 +164,6 @@ ports_manage_port_operations_multithread (struct port_bucket *bucket,
return 0;
}
- /* Wire this because hurd_thread_cancel will not interoperate
- cleanly with cthreads cleverness yet. */
- wire_cthreads = 1;
-
- thread_timeout = global_timeout = 0; /* XXX */
-
nreqthreads = 1;
totalthreads = 1;
thread_function (1);