diff options
-rw-r--r-- | libports/manage-multithread.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/libports/manage-multithread.c b/libports/manage-multithread.c index c25bfd38..309b3038 100644 --- a/libports/manage-multithread.c +++ b/libports/manage-multithread.c @@ -74,8 +74,8 @@ ports_manage_port_operations_multithread (struct port_bucket *bucket, int global_timeout, void (*hook)()) { - volatile int nreqthreads; - volatile int totalthreads; + volatile unsigned int nreqthreads; + volatile unsigned int totalthreads; spin_lock_t lock = SPIN_LOCK_INITIALIZER; auto int thread_function (int); @@ -84,7 +84,6 @@ ports_manage_port_operations_multithread (struct port_bucket *bucket, internal_demuxer (mach_msg_header_t *inp, mach_msg_header_t *outheadp) { - int spawn = 0; int status; struct port_info *pi; struct rpc_info link; @@ -102,14 +101,11 @@ ports_manage_port_operations_multithread (struct port_bucket *bucket, spin_lock (&lock); assert (nreqthreads); nreqthreads--; - if (nreqthreads == 0) + if (nreqthreads != 0) + spin_unlock (&lock); + else /* No thread would be listening for requests, spawn one. */ - spawn = 1; - spin_unlock (&lock); - - if (spawn) { - spin_lock (&lock); totalthreads++; nreqthreads++; spin_unlock (&lock); |