package ex02;

public class Producteur extends Thread
{
	EntierPartage monEntier;
	public Producteur (String pNom, EntierPartage pEntier)
	{
		super(pNom);
		this.monEntier = pEntier;
	}
	
	public void run()
	{
		for (int i = 1; i <= 10; i++)
		{
			try
			{
				Thread.sleep ((long)(1000 + Math.random() * 3000));
			}
			catch (InterruptedException e)
			{
				e.printStackTrace();
			}
			this.monEntier.setValeur(i);
		}
		System.err.println("Fin du thread " + this.getName());
	}
}
