From 63eaee18781c6a0c1620eac50015433e52c15fab Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Wed, 22 Nov 1995 21:21:11 +0000 Subject: If calling thread is serving an RPC, don't block waiting for that RPC to finish. --- libports/inhibit-bucket-rpcs.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'libports') diff --git a/libports/inhibit-bucket-rpcs.c b/libports/inhibit-bucket-rpcs.c index 41918cc4..09345755 100644 --- a/libports/inhibit-bucket-rpcs.c +++ b/libports/inhibit-bucket-rpcs.c @@ -1,4 +1,4 @@ -/* +/* Copyright (C) 1995 Free Software Foundation, Inc. Written by Michael I. Bushnell. @@ -26,28 +26,31 @@ void ports_inhibit_bucket_rpcs (struct port_bucket *bucket) { + int this_one = 0; + error_t interruptor (void *portstruct) { struct port_info *pi = portstruct; struct rpc_info *rpc; - + for (rpc = pi->current_rpcs; rpc; rpc = rpc->next) - hurd_thread_cancel (rpc->thread); + if (hurd_thread_cancel (rpc->thread) == EINTR) + this_one = 1; return 0; } - + mutex_lock (&_ports_lock); ihash_iterate (bucket->htable, interruptor); - while (bucket->rpcs) + while (bucket->rpcs > this_one) { bucket->flags |= PORT_BUCKET_INHIBIT_WAIT; condition_wait (&_ports_block, &_ports_lock); } - + bucket->flags |= PORT_BUCKET_INHIBITED; bucket->flags &= ~PORT_CLASS_INHIBIT_WAIT; - + mutex_unlock (&_ports_lock); } -- cgit v1.2.3