diff options
Diffstat (limited to 'libports/inhibit-class-rpcs.c')
-rw-r--r-- | libports/inhibit-class-rpcs.c | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/libports/inhibit-class-rpcs.c b/libports/inhibit-class-rpcs.c index 7ee86538..9a87a5ff 100644 --- a/libports/inhibit-class-rpcs.c +++ b/libports/inhibit-class-rpcs.c @@ -36,15 +36,24 @@ ports_inhibit_class_rpcs (struct port_class *class) struct rpc_info *rpc; int this_one = 0; - for (pi = class->ports; pi; pi = pi->next) - for (rpc = pi->current_rpcs; rpc; rpc = rpc->next) - { - /* Avoid cancelling the calling thread. */ - if (rpc->thread == hurd_thread_self ()) - this_one = 1; - else - hurd_thread_cancel (rpc->thread); - } + pthread_rwlock_rdlock (&_ports_htable_lock); + HURD_IHASH_ITERATE (&_ports_htable, portstruct) + { + struct rpc_info *rpc; + struct port_info *pi = portstruct; + if (pi->class != class) + continue; + + for (rpc = pi->current_rpcs; rpc; rpc = rpc->next) + { + /* Avoid cancelling the calling thread. */ + if (rpc->thread == hurd_thread_self ()) + this_one = 1; + else + hurd_thread_cancel (rpc->thread); + } + } + pthread_rwlock_unlock (&_ports_htable_lock); while (class->rpcs > this_one) { |