| 169 | } |
| 170 | |
| 171 | static public Object rejoin() throws InterruptedException, Stop { |
| 172 | if (fiber.get() == null) |
| 173 | throw new IllegalArgumentException(" yield called from non-fiber thread"); |
| 174 | |
| 175 | fiber.get().debugStatus = "rejoined from " + Arrays.asList(new Exception().getStackTrace()); |
| 176 | |
| 177 | if (fiber.get().stopped) throw new Stop(); |
| 178 | |
| 179 | List<Object> c = new ArrayList<Object>(); |
| 180 | fiber.get().input.drainTo(c); |
| 181 | |
| 182 | Object t = fiber.get().input.take(); |
| 183 | |
| 184 | if (fiber.get().stopped) throw new Stop(); |
| 185 | |
| 186 | return c; |
| 187 | } |
| 188 | |
| 189 | static public Object wait(int n) throws InterruptedException, Stop { |
| 190 | Object q = null; |