diff src/alice/test/dpp/codesegment/TakeForkCodeSegment.java @ 15:7e91e919a7de

modified
author one
date Sun, 09 Dec 2012 22:09:46 +0900
parents 33727db069c2
children 6018e62cb198
line wrap: on
line diff
--- a/src/alice/test/dpp/codesegment/TakeForkCodeSegment.java	Wed Nov 28 17:41:42 2012 +0900
+++ b/src/alice/test/dpp/codesegment/TakeForkCodeSegment.java	Sun Dec 09 22:09:46 2012 +0900
@@ -14,6 +14,7 @@
 
 	public TakeForkCodeSegment(String pName, String rFork, String lFork) {
 		arg1.setKey(pName);
+		// dead lock
 		arg2.setKey(rFork);
 		arg3.setKey(lFork);
 	}
@@ -24,12 +25,14 @@
 		Fork rightFork = arg2.asClass(Fork.class);
 		Fork leftFork = arg3.asClass(Fork.class);
 		System.out.println(phil.getName() + " is trying to take the fork.");
+
 		if (leftFork.getFork(phil.getName()) && rightFork.getFork(phil.getName()) ) {
 			phil.setState(Philosophy.State.EAT);
 		} else {
 			leftFork.onTheTable(phil.getName());
 			rightFork.onTheTable(phil.getName());
 		}
+
 		new ScheduleCodeSegment(phil.getName());
 		ods.update("local", phil.getName(), phil);
 		ods.update("local", leftFork.getForkName(), leftFork);