コード例 #1
0
 public Human(HairSaloon saloon, int index)
 {
     HumanThread = new Thread(new ThreadStart(Run));
     State       = HumanState.Outside;
     Saloon      = saloon;
     _index      = index;
 }
コード例 #2
0
        static void Main(string[] args)
        {
            HairSaloon mainSallon = new HairSaloon();

            List<Human> people = new List<Human>();

            for (int i = 0; i < Program.peopleCount; ++i)
            {
                people.Add(new Human(mainSallon, i + 1));
                people[i].HumanThread.Start();
            }

            for (int i = 0; i < people.Count; ++i)
            {
                people[i].HumanThread.Join();
            }

            Console.WriteLine("Ended");

            Console.ReadLine();
        }
コード例 #3
0
        static void Main(string[] args)
        {
            HairSaloon mainSallon = new HairSaloon();

            List <Human> people = new List <Human>();

            for (int i = 0; i < Program.peopleCount; ++i)
            {
                people.Add(new Human(mainSallon, i + 1));
                people[i].HumanThread.Start();
            }

            for (int i = 0; i < people.Count; ++i)
            {
                people[i].HumanThread.Join();
            }

            Console.WriteLine("Ended");

            Console.ReadLine();
        }