summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>1995-12-28 18:15:10 +0000
committerMiles Bader <miles@gnu.org>1995-12-28 18:15:10 +0000
commit3be5474d345378ccb1c8d91655893b779a0e4924 (patch)
treec708ff6e921b10813df9be967d14962848943761
parent12c19060a161e9f11cc19c7b6a0f461c7d7436e1 (diff)
(ports_interrupt_notified_rpcs):
Only bother to lock _PORTS_LOCK if there are notifications.
-rw-r--r--libports/interrupt-notified-rpcs.c35
1 files changed, 19 insertions, 16 deletions
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