1 26 27 package DiningPhilosophers.cif; 28 29 import DiningPhilosophers.*; 30 31 39 40 public class ForkSegImpl 41 extends DiningPhilosophers.ForkManagerSessionComposition.ForkSeg 42 { 43 49 50 private boolean available_; 51 52 58 59 public 60 ForkSegImpl() 61 { 62 available_ = true; 63 } 64 65 71 77 83 89 public void 90 get() 91 throws InUse 92 { 93 if (! available_) 95 { 96 throw new InUse(); 97 } 98 99 available_ = false; 101 } 102 103 106 public void 107 release() 108 { 109 if (available_) 111 { 112 return; 113 } 114 115 available_ = true; 117 } 118 } 119 | Popular Tags |