From 3be5474d345378ccb1c8d91655893b779a0e4924 Mon Sep 17 00:00:00 2001 From: Miles Bader Date: Thu, 28 Dec 1995 18:15:10 +0000 Subject: (ports_interrupt_notified_rpcs): Only bother to lock _PORTS_LOCK if there are notifications. --- libports/interrupt-notified-rpcs.c | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) (limited to 'libports') diff --git a/libports/interrupt-notified-rpcs.c b/libports/interrupt-notified-rpcs.c index a88e398a..061d3d87 100644 --- a/libports/interrupt-notified-rpcs.c +++ b/libports/interrupt-notified-rpcs.c @@ -32,22 +32,25 @@ void ports_interrupt_notified_rpcs (void *object, mach_port_t port, mach_msg_id_t what) { - struct ports_notify *np; - - mutex_lock (&_ports_lock); - for (np = _ports_notifications; np; np = np->next) - if (np->port == port && np->what == what) - { - struct rpc_notify *req; - for (req = np->reqs; req; req = req->next_req) - if (req->pending) - { - req->pending--; - hurd_thread_cancel (req->rpc->thread); - } - break; - } - mutex_unlock (&_ports_lock); + if (_ports_notifications) + { + struct ports_notify *np; + + mutex_lock (&_ports_lock); + for (np = _ports_notifications; np; np = np->next) + if (np->port == port && np->what == what) + { + struct rpc_notify *req; + for (req = np->reqs; req; req = req->next_req) + if (req->pending) + { + req->pending--; + hurd_thread_cancel (req->rpc->thread); + } + break; + } + mutex_unlock (&_ports_lock); + } } static void -- cgit v1.2.3