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.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/libports/inhibit-all-rpcs.c b/libports/inhibit-all-rpcs.c
index d4a54ba5..27e2ec54 100644
--- a/libports/inhibit-all-rpcs.c
+++ b/libports/inhibit-all-rpcs.c
@@ -36,24 +36,23 @@ ports_inhibit_all_rpcs ()
struct port_bucket *bucket;
int this_one = 0;
- for (bucket = _ports_all_buckets; bucket; bucket = bucket->next)
+ pthread_rwlock_rdlock (&_ports_htable_lock);
+ HURD_IHASH_ITERATE (&_ports_htable, portstruct)
{
- HURD_IHASH_ITERATE (&bucket->htable, portstruct)
+ struct rpc_info *rpc;
+ struct port_info *pi = portstruct;
+
+ for (rpc = pi->current_rpcs; rpc; rpc = rpc->next)
{
- 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);
- }
+ /* 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);
}
}
+ pthread_rwlock_unlock (&_ports_htable_lock);
while (_ports_total_rpcs > this_one)
{