- /* strip server terminated bit */
- alert_bits = cur_act->alerts & (~SERVER_TERMINATED);
-
- /* clear server terminated bit */
- cur_act->alerts &= ~SERVER_TERMINATED;
-
- if ( alert_bits ) {
- /*
- * currently necessary to coordinate with the exception
- * code -fdr
- */
- act_unlock_thread(cur_act);
-
- /* upcall exception/alert port */
- codes[0] = alert_bits;
-
- /*
- * Exception makes a lot of assumptions. If there is no
- * exception handler or the exception reply is broken, the
- * thread will be terminated and exception will not return. If
- * we decide we don't like that behavior, we need to check
- * for the existence of an exception port before we call
- * exception.
- */
- exc_kr = exception( EXC_RPC_ALERT, codes, 1 );
-
- /* clear the orphaned and time constraint indications */
- cur_act->alerts &= ~(ORPHANED | TIME_CONSTRAINT_UNSATISFIED);
-
- /* if this orphaned activation should be terminated... */
- if (exc_kr == KERN_RPC_TERMINATE_ORPHAN) {
- /*
- * ... terminate the activation
- *
- * This is done in two steps. First, the activation is
- * disabled (prepared for termination); second, the
- * `special_handler()' is executed again -- this time
- * to terminate the activation.
- * (`act_disable_task_locked()' arranges for the
- * additional execution of the `special_handler().')
- */
-
-#if THREAD_SWAPPER
- thread_swap_disable(cur_act);
-#endif /* THREAD_SWAPPER */
-
- /* acquire appropriate locks */
- task_lock(cur_act->task);
- act_lock_thread(cur_act);
-
- /* detach the activation from its task */
- kr = act_disable_task_locked(cur_act);
- assert( kr == KERN_SUCCESS );
-
- /* release locks */
- task_unlock(cur_act->task);
- }
- else {
- /* acquire activation lock again (released below) */
- act_lock_thread(cur_act);
- s = splsched();
- thread_lock(thread);
- if (thread->depress_priority == -2) {
- /*
- * We were temporarily undepressed by
- * install_special_handler; restore priority
- * depression.
- */
- thread->depress_priority = thread->priority;
- thread->priority = thread->sched_pri = DEPRESSPRI;
- }
- thread_unlock(thread);
- splx(s);
- }