ToolChain/bin/targets/m68k-amigaos/ndk/Tutorials/ARexx/Host/Host.c
VOID
DeleteRexxHost(struct RexxHost * Host)
{
	struct RexxMsg * Message;

		/* Did we get a valid host pointer? */

	if(Host != NULL)
	{
			/* Turn off multitasking while we remove the
			 * public message port.
			 */

		Forbid();

			/* Remove the message port. */

		RemPort(Host->GlobalPort);

			/* Now enable multitasking again. */

		Permit();

			/* Remove all pending rexx messages from the
			 * port and reply them to their owners.
			 */

		while((Message = (struct RexxMsg *)GetMsg(Host->GlobalPort))
			!= NULL)
		{
				/* Reject all messages. */

			Message->rm_Result1 = RC_FATAL;

			ReplyMsg((struct Message *)Message);
		}

			/* Delete the message port. */

		DeleteMsgPort(Host->GlobalPort);

			/* Free the memory allocated. */

		FreeVec(Host);
	}
}
/****** Host/DeleteRexxHost **************************************************
*
*   NAME
*       DeleteRexxHost -- Remove a rexx host port previously created by
*           CreateRexxHost.
*
*   SYNOPSIS
*       DeleteRexxHost(Host)
*
*       VOID DeleteRexxHost(struct RexxHost *);
*
*   FUNCTION
*       Before your application exits, call this routine on every rexx host
*       environment you created with CreateRexxHost(). If you forget to do so
*       your application will leave unused memory and, in case it was
*       run from Shell, signal bits allocated which can never be reclaimed.
*
*   INPUTS
*       Host - Result of CreateRexxHost() call. May be NULL in which case
*           this routine will do nothing.
*
*   RESULT
*       None
*
*   SEE ALSO
*       exec.library/DeleteMsgPort
*       exec.library/RemPort
*       CreateRexxHost
*
******************************************************************************
*
*/
Host/DeleteRexxHost
NAME
DeleteRexxHost -- Remove a rexx host port previously created by
CreateRexxHost.





FUNCTION
Before your application exits, call this routine on every rexx host
environment you created with CreateRexxHost(). If you forget to do so
your application will leave unused memory and, in case it was
run from Shell, signal bits allocated which can never be reclaimed.

INPUTS
Host - Result of CreateRexxHost() call. May be NULL in which case
this routine will do nothing.

RESULT
None


Host / DeleteRexxHost NAME DeleteRexxHost -- Remove a rexx host port previously created by CreateRexxHost . FUNCTION Before your application exits call this routine on every rexx host environment you created with CreateRexxHost () . If you forget to do so your application will leave unused memory and in case it was run from Shell signal bits allocated which can never be reclaimed . INPUTS Host - Result of CreateRexxHost () call . May be NULL in which case this routine will do nothing . RESULT None
VOID
DeleteRexxHost(struct RexxHost * Host)
{
	struct RexxMsg * Message;
	if(Host != NULL)
	{
		Forbid();
		RemPort(Host->GlobalPort);
		Permit();
		while((Message = (struct RexxMsg *)GetMsg(Host->GlobalPort))
			!= NULL)
		{
			Message->rm_Result1 = RC_FATAL;
			ReplyMsg((struct Message *)Message);
		}
		DeleteMsgPort(Host->GlobalPort);
		FreeVec(Host);
	}
}
VOID DeleteRexxHost ( struct RexxHost * Host ) { struct RexxMsg * Message ; if ( Host != NULL ) { Forbid ( ) ; RemPort ( Host -> GlobalPort ) ; Permit ( ) ; while ( ( Message = ( struct RexxMsg * ) GetMsg ( Host -> GlobalPort ) ) != NULL ) { Message -> rm_Result1 = RC_FATAL ; ReplyMsg ( ( struct Message * ) Message ) ; } DeleteMsgPort ( Host -> GlobalPort ) ; FreeVec ( Host ) ; } }
Host/DeleteRexxHost
NAME
DeleteRexxHost -- Remove a rexx host port previously created by
CreateRexxHost.
Host / DeleteRexxHost NAME DeleteRexxHost -- Remove a rexx host port previously created by CreateRexxHost .
/* Did we get a valid host pointer? */ /* Turn off multitasking while we remove the
			 * public message port.
			 */ /* Remove the message port. */ /* Now enable multitasking again. */ /* Remove all pending rexx messages from the
			 * port and reply them to their owners.
			 */ /* Reject all messages. */ /* Delete the message port. */ /* Free the memory allocated. */