summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael I. Bushnell <mib@gnu.org>1996-01-29 20:32:50 +0000
committerMichael I. Bushnell <mib@gnu.org>1996-01-29 20:32:50 +0000
commitd7bc26b053598cf8556b16c2470f5934e0ffb5a8 (patch)
tree1d354a08c05a03a2f42d441d87f501286dcd62f7
parent4226a60bb0aa407c145593aa10daba13f10e3861 (diff)
(fshelp_set_active): Deal correctly with the case where a passive
translator is being started.
-rw-r--r--libfshelp/set-active.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/libfshelp/set-active.c b/libfshelp/set-active.c
index b2f49cf4..f2cc297b 100644
--- a/libfshelp/set-active.c
+++ b/libfshelp/set-active.c
@@ -1,5 +1,5 @@
/*
- Copyright (C) 1995 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1996 Free Software Foundation, Inc.
Written by Michael I. Bushnell.
This file is part of the GNU Hurd.
@@ -26,9 +26,20 @@ fshelp_set_active (struct transbox *box,
mach_port_t active,
int excl)
{
- if (excl && box->active != MACH_PORT_NULL)
+ int cancel;
+
+ if (excl
+ && ((box->active != MACH_PORT_NULL) || (box->flags & TRANSBOX_STARTING)))
return EBUSY;
+ while (box->flags & TRANSBOX_STARTING)
+ {
+ box->flags |= TRANSBOX_WANTED;
+ cancel = hurd_condition_wait (&box->wakeup, box->lock);
+ if (cancel)
+ return EINTR;
+ }
+
if (box->active != MACH_PORT_NULL)
mach_port_deallocate (mach_task_self (), box->active);