summaryrefslogtreecommitdiff
path: root/libports/inhibit-port-rpcs.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1995-11-18 14:54:01 +0000
committerRoland McGrath <roland@gnu.org>1995-11-18 14:54:01 +0000
commitd3f649ba551ed42b319f11d3207dd5ad1703ca0c (patch)
tree28dfcad91b83370220a878ad588d1296cf1644c4 /libports/inhibit-port-rpcs.c
parent5636382647c32d771308aaf8d5045d29da6844f3 (diff)
If calling thread is serving an RPC, don't block waiting for that RPC to
finish.
Diffstat (limited to 'libports/inhibit-port-rpcs.c')
-rw-r--r--libports/inhibit-port-rpcs.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/libports/inhibit-port-rpcs.c b/libports/inhibit-port-rpcs.c
index 718a8b3e..f4ddf497 100644
--- a/libports/inhibit-port-rpcs.c
+++ b/libports/inhibit-port-rpcs.c
@@ -1,4 +1,4 @@
-/*
+/*
Copyright (C) 1995 Free Software Foundation, Inc.
Written by Michael I. Bushnell.
@@ -26,19 +26,23 @@ void
ports_inhibit_port_rpcs (void *portstruct)
{
struct port_info *pi = portstruct;
- struct rpc_info *rpc;
-
+ struct rpc_info *rpc, *this_rpc;
+
mutex_lock (&_ports_lock);
+ this_rpc = 0;
for (rpc = pi->current_rpcs; rpc; rpc = rpc->next)
- hurd_thread_cancel (rpc->thread);
-
- while (pi->current_rpcs)
+ if (hurd_thread_cancel (rpc->thread) == EINTR)
+ this_rpc = rpc;
+
+ while (pi->current_rpcs
+ /* If this thread's RPC is the only one left, that doesn't count. */
+ && !(pi->current_rpcs == this_rpc && ! this_rpc->next))
{
pi->flags |= PORT_INHIBIT_WAIT;
condition_wait (&_ports_block, &_ports_lock);
}
-
+
pi->flags |= PORT_INHIBITED;
pi->flags &= ~PORT_INHIBIT_WAIT;