From 317f76798849bac85c692c76475a85be0f592dab Mon Sep 17 00:00:00 2001 From: Mark Kettenis Date: Tue, 25 Jul 2000 22:34:00 +0000 Subject: * inhibit-all-rpcs.c (ports_inhibit_all_rpcs): Avoid calling hurd_thread_cancel on the current thread. * inhibit-class-rpcs.c (ports_inhibit_class_rpcs): Likewise. * inhibit-bucket-rpcs.c (ports_inhibit_bucket_rpcs): Likewise. * inhibit-port-rpcs.c (ports_inhibit_port_rpcs): Likewise. --- libports/ChangeLog | 8 ++++++++ libports/inhibit-all-rpcs.c | 15 ++++++++++----- libports/inhibit-bucket-rpcs.c | 12 +++++++++--- libports/inhibit-class-rpcs.c | 11 ++++++++--- libports/inhibit-port-rpcs.c | 11 ++++++++--- 5 files changed, 43 insertions(+), 14 deletions(-) (limited to 'libports') diff --git a/libports/ChangeLog b/libports/ChangeLog index 4ac61f9a..b226924d 100644 --- a/libports/ChangeLog +++ b/libports/ChangeLog @@ -1,3 +1,11 @@ +2000-07-25 Mark Kettenis + + * inhibit-all-rpcs.c (ports_inhibit_all_rpcs): Avoid calling + hurd_thread_cancel on the current thread. + * inhibit-class-rpcs.c (ports_inhibit_class_rpcs): Likewise. + * inhibit-bucket-rpcs.c (ports_inhibit_bucket_rpcs): Likewise. + * inhibit-port-rpcs.c (ports_inhibit_port_rpcs): Likewise. + 2000-03-17 Roland McGrath * get-send-right.c: New file. diff --git a/libports/inhibit-all-rpcs.c b/libports/inhibit-all-rpcs.c index 13aa62c6..9efb3c2f 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. @@ -42,8 +42,15 @@ ports_inhibit_all_rpcs () struct port_info *pi = portstruct; for (rpc = pi->current_rpcs; rpc; rpc = rpc->next) - if (hurd_thread_cancel (rpc->thread) == EINTR) - this_one = 1; + { + /* 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); + } + return 0; } @@ -70,5 +77,3 @@ ports_inhibit_all_rpcs () return err; } - - diff --git a/libports/inhibit-bucket-rpcs.c b/libports/inhibit-bucket-rpcs.c index a04906ff..06af9c60 100644 --- a/libports/inhibit-bucket-rpcs.c +++ b/libports/inhibit-bucket-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. @@ -41,8 +41,14 @@ ports_inhibit_bucket_rpcs (struct port_bucket *bucket) struct port_info *pi = portstruct; for (rpc = pi->current_rpcs; rpc; rpc = rpc->next) - if (hurd_thread_cancel (rpc->thread) == EINTR) - this_one = 1; + { + /* Avoid cancelling the calling thread. */ + if (rpc->thread == hurd_thread_self ()) + this_one = 1; + else + hurd_thread_cancel (rpc->thread); + } + return 0; } diff --git a/libports/inhibit-class-rpcs.c b/libports/inhibit-class-rpcs.c index 00b9b361..951de4bf 100644 --- a/libports/inhibit-class-rpcs.c +++ b/libports/inhibit-class-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. @@ -39,8 +39,13 @@ ports_inhibit_class_rpcs (struct port_class *class) for (pi = class->ports; pi; pi = pi->next) for (rpc = pi->current_rpcs; rpc; rpc = rpc->next) - if (hurd_thread_cancel (rpc->thread) == EINTR) - this_one = 1; + { + /* Avoid cancelling the calling thread. */ + if (rpc->thread == hurd_thread_self ()) + this_one = 1; + else + hurd_thread_cancel (rpc->thread); + } while (class->rpcs > this_one) { diff --git a/libports/inhibit-port-rpcs.c b/libports/inhibit-port-rpcs.c index 4ec5d853..02a3b462 100644 --- a/libports/inhibit-port-rpcs.c +++ b/libports/inhibit-port-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. @@ -38,8 +38,13 @@ ports_inhibit_port_rpcs (void *portstruct) struct rpc_info *this_rpc = 0; for (rpc = pi->current_rpcs; rpc; rpc = rpc->next) - if (hurd_thread_cancel (rpc->thread) == EINTR) - this_rpc = rpc; + { + /* Avoid cancelling the calling thread. */ + if (rpc->thread == hurd_thread_self ()) + this_rpc = rpc; + else + hurd_thread_cancel (rpc->thread); + } while (pi->current_rpcs /* If this thread's RPC is the only one left, it doesn't count. */ -- cgit v1.2.3