#include <arpbase.h>
#include <arp_proto.h>
#include "Launch.h"
#include "LaunchPriv.h"


/*
 *	NAME
 *		CheckAlive -- check if the process is still alive.
 *
 *	SYNOPSIS
 *		alive = CheckAlive (Proc)
 *
 *		BOOL CheckAlive (struct Process *);
 *
 *	DESCRIPTION
 *		Scan the list of process pair for a pair whose child is the
 *		process passed as input.  It then check if the entry point is
 *		NULL, meaning the child is dead.
 *
 *	INPUT
 *		Proc - the process who wants to find if it's alive.
 *
 *	OUTPUT
 *		alive - non-null if the process is alive.
 *
 *	NOTE
 *		This function can be used as a polling mecanism to find out
 *		if the child still exists.
 *
 *	HISTORY
 *		1992/09/06	Pierre Baillargeon		Creation
 *
 */

BOOL CheckAlive (struct Process *Proc)
{
	struct ProcPair *pp;
	BOOL result;

	Forbid ();
	if (NULL != ProcPairList && NULL != (pp = IsChild (Proc)))
	{
		result = (pp->pp_ChildEntry != NULL);
	}
	else
	{
		result = 0;
	}
	Permit ();

	return result;
}
