()
| 16 | } |
| 17 | |
| 18 | public void eat() { |
| 19 | System.out.println("Philosopher " + index + ": start eating"); |
| 20 | if (pickUp()) { |
| 21 | chew(); |
| 22 | putDown(); |
| 23 | System.out.println("Philosopher " + index + ": done eating"); |
| 24 | } else { |
| 25 | System.out.println("Philosopher " + index + ": gave up on eating"); |
| 26 | } |
| 27 | } |
| 28 | |
| 29 | public boolean pickUp() { |
| 30 | pause(); |