/******************************************************************************
 **
 **	C++ Class Library for the Amiga© system software.
 **
 **	Copyright (C) 1994 by Armin Vogt  **  EMail: armin@uni-paderborn.de
 **	All Rights Reserved.
 **
 **	$Source: apphome:APlusPlus/RCS/libsource/LvObject.cxx,v $
 **	$Revision: 1.3 $
 **	$Date: 1994/04/23 21:01:55 $
 **	$Author: Armin_Vogt $
 **
 ******************************************************************************/


extern "C" {
#ifdef __GNUG__
#include <inline/exec.h>
#endif

#ifdef __SASC
#include <proto/exec.h>
#endif
}

#include <APlusPlus/exec/LvObject.h>

volatile static char rcs_id[] = "$Id: LvObject.cxx,v 1.3 1994/04/23 21:01:55 Armin_Vogt Exp Armin_Vogt $";


// Living Objects depend on the AMIPROC package by Doug Walker and Steve Krueger.
// At the moment it is therefore impossible to compile with GNU-C++.
#ifdef __SASC

LivingObject::LivingObject()
{
	ap_msg = NULL;
}

BOOL LivingObject::activate()
{
	if (ap_msg) return TRUE;
	
	ap_msg = AmiProc_Start((int (*)(void*))func,(void*)this);
	return (ap_msg!=NULL);
}

LivingObject::~LivingObject()
{
	AmiProc_Wait(ap_msg);
}

BOOL LivingObject::isLiving()
{
	return (ap_msg!=NULL);
}

int LivingObject::func(void *thisPtr)
{
	return ((LivingObject*)thisPtr)->main();
}

#endif
