| 147 | } |
| 148 | |
| 149 | static public void leave(Object o) throws InterruptedException, Stop { |
| 150 | if (fiber.get() == null) |
| 151 | throw new IllegalArgumentException(" yield called from non-fiber thread"); |
| 152 | |
| 153 | fiber.get().debugStatus = "leave from " + Arrays.asList(new Exception().getStackTrace()); |
| 154 | |
| 155 | if (fiber.get().stopped) throw new Stop(); |
| 156 | if (o == null) o = NULL; |
| 157 | |
| 158 | Object t = fiber.get().input.poll(); |
| 159 | fiber.get().output.offer(o); |
| 160 | |
| 161 | if (fiber.get().stopped) throw new Stop(); |
| 162 | |
| 163 | } |
| 164 | |
| 165 | static public void leaveFor(int n, Object o) throws InterruptedException, Stop { |
| 166 | for (int i = 0; i < n; i++) { |