@Override public void run() throws SuspendExecution { try { Val.this.set0(f.run()); } catch (Throwable t) { Val.this.setException0(t); } } }).start();
protected V run() throws SuspendExecution, InterruptedException { if (target != null) return target.run(); return null; }
protected V run() throws SuspendExecution, InterruptedException { if (target != null) return target.run(); return null; }
@Override public void run() { try { callable.run(); } catch (SuspendExecution ex) { throw new AssertionError(ex); } catch (InterruptedException ex) { } catch (Exception e) { throw Exceptions.rethrow(e); } } }
@Override protected final void behavior() throws InterruptedException, SuspendExecution { while (isRunning()) { if (state == null) throw new NullPointerException(); if (state == TERMINATE) break; checkCodeSwap(); state = state.run(); } }
private void sequentialTransfer() throws InterruptedException, SuspendExecution { S s = from.receive(); while (s != null) { // Build result channel final Channel<T> res = resultChannelBuilder.run(); // Process transformer.call(s, res); T out = res.receive(); while(out != null) { // Send to output channel to.send(out); // Increment counter transferred.incrementAndGet(); // Get next result out = res.receive(); } s = from.receive(); } } }
if (v == null) break; T newVal = v.f.run(); Var.record("run", "Fiber %s for var %s computed new value %s", this, var, newVal); v.set(newVal);
@Override public void run() throws SuspendExecution, InterruptedException { // Get first job Pair<S, Channel<Channel<T>>> job = jobs.receive(); while(job != null) { // Build result channel final Channel<T> res = resultChannelBuilder.run(); // Process transformer.call(job.getFirst(), res); final Channel<Channel<T>> resWrapper = job.getSecond(); // Send result asynchronously strandFactory.newStrand(SuspendableUtils.runnableToCallable(new SuspendableRunnable() { @Override public void run() throws SuspendExecution, InterruptedException { resWrapper.send(res); } })).start(); // Get next job job = jobs.receive(); } // No more jobs, close results channel and quit worker results.close(); } })).start();