summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1995-11-22 21:21:11 +0000
committerRoland McGrath <roland@gnu.org>1995-11-22 21:21:11 +0000
commit63eaee18781c6a0c1620eac50015433e52c15fab (patch)
tree45838c8e76e5c6fc60e1bfadde45c7bee63b80cc
parentbf0c35664f944619dfd90c6ab5db43a824650362 (diff)
If calling thread is serving an RPC, don't block waiting for that RPC to
finish.
-rw-r--r--libports/inhibit-bucket-rpcs.c17
1 files changed, 10 insertions, 7 deletions
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);
}