summaryrefslogtreecommitdiff
path: root/libports/inhibit-all-rpcs.c
diff options
context:
space:
mode:
Diffstat (limited to 'libports/inhibit-all-rpcs.c')
-rw-r--r--libports/inhibit-all-rpcs.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/libports/inhibit-all-rpcs.c b/libports/inhibit-all-rpcs.c
index 13aa62c6..9a72f83e 100644
--- a/libports/inhibit-all-rpcs.c
+++ b/libports/inhibit-all-rpcs.c
@@ -1,5 +1,5 @@
/*
- Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1996, 2000 Free Software Foundation, Inc.
Written by Michael I. Bushnell.
This file is part of the GNU Hurd.
@@ -36,19 +36,25 @@ ports_inhibit_all_rpcs ()
{
struct port_bucket *bucket;
int this_one = 0;
- error_t interruptor (void *portstruct)
- {
- struct rpc_info *rpc;
- struct port_info *pi = portstruct;
-
- for (rpc = pi->current_rpcs; rpc; rpc = rpc->next)
- if (hurd_thread_cancel (rpc->thread) == EINTR)
- this_one = 1;
- return 0;
- }
for (bucket = _ports_all_buckets; bucket; bucket = bucket->next)
- ihash_iterate (bucket->htable, interruptor);
+ {
+ HURD_IHASH_ITERATE (&bucket->htable, portstruct)
+ {
+ struct rpc_info *rpc;
+ struct port_info *pi = portstruct;
+
+ for (rpc = pi->current_rpcs; rpc; rpc = rpc->next)
+ {
+ /* Avoid cancelling the calling thread if it's currently
+ handling a RPC. */
+ if (rpc->thread == hurd_thread_self ())
+ this_one = 1;
+ else
+ hurd_thread_cancel (rpc->thread);
+ }
+ }
+ }
while (_ports_total_rpcs > this_one)
{
@@ -70,5 +76,3 @@ ports_inhibit_all_rpcs ()
return err;
}
-
-