예제 #1
0
            public static void Platao()
            {
                Philosopher platao   = new Philosopher("Platao");
                Employee    employee = new Employee();

                lock (platao) {
                    platao.thinking();
                    platao.hungry();
                    lock (platao) {
                        platao.pickForkRight();
                        platao.pickForkLeft();
                    }
                    platao.eat();
                    employee.employeeServes();
                }
            }
예제 #2
0
            public static void Kant()
            {
                Thread.Sleep(5000);
                Philosopher kant     = new Philosopher("Kant");
                Employee    employee = new Employee();

                lock (kant) {
                    kant.thinking();
                    kant.hungry();
                    lock (kant) {
                        kant.pickForkRight();
                        kant.pickForkLeft();
                    }
                    kant.eat();
                    employee.employeeServes();
                }
            }
예제 #3
0
            public static void Socrates()
            {
                Thread.Sleep(3000);
                Philosopher socrates = new Philosopher("Socrates");
                Employee    employee = new Employee();

                lock (socrates) {
                    socrates.thinking();
                    socrates.hungry();
                    lock (socrates) {
                        socrates.pickForkRight();
                        socrates.pickForkLeft();
                    }
                    socrates.eat();
                    employee.employeeServes();
                }
            }
예제 #4
0
            public static void Aristotales()
            {
                Thread.Sleep(4000);
                Philosopher aristotales = new Philosopher("Aristotales");
                Employee    employee    = new Employee();

                lock (aristotales) {
                    aristotales.thinking();
                    aristotales.hungry();
                    lock (aristotales) {
                        aristotales.pickForkRight();
                        aristotales.pickForkLeft();
                    }
                    aristotales.eat();
                    employee.employeeServes();
                }
            }
예제 #5
0
            public static void Epicurus()
            {
                Thread.Sleep(2000);
                Philosopher epicurus = new Philosopher("Epicurus");
                Employee    employee = new Employee();

                lock (epicurus) {
                    epicurus.thinking();
                    epicurus.hungry();
                    lock (epicurus) {
                        epicurus.pickForkRight();
                        epicurus.pickForkLeft();
                    }
                    epicurus.eat();
                    employee.employeeServes();
                }
            }