/*
 * Copyright (c) 2000, 2001 The University of Utah and the Flux Group.
 * All rights reserved.
 *
 * Permission to use, copy, modify, and distribute this file
 * for any purpose with or without restriction is hereby granted.
 */

/* All JanosVM specific classes exist in the package edu.utah.janosvm. */
import edu.utah.janosvm.sys.Team;
import edu.utah.janosvm.sys.TeamHandle;

public class HelloNewTeam
{

    public static void main(String args[])
	throws Exception
    {
	/* Print out the name of the current team, should be kernel. */
	System.out.println(Team.current().getName() +
			   " says hello");
	
	/*
	 * Create a child team with the name `child' and default
	 * resources
	 */
	TeamHandle child = Team.create("Child");

	/* Visit the child team and do some work */
	child.switchTo();
	{
	    /*
	     * Print out the name of the current team,
	     * should now be `Child'.
	     */
	    System.out.println(Team.current().getName()
			       + " says hello");
	}
	/* End the visit and return to the kernel */
	child.returnFrom();
	/*
	 * Cleanup, terminate the child and return its resources to the
	 * system.
	 */
	child.terminate();
    }
    
}
