Skip to content

Instantly share code, notes, and snippets.

package foo;
import co.paralleluniverse.fibers.*;
import co.paralleluniverse.strands.*;
import co.paralleluniverse.strands.channels.*;
import static co.paralleluniverse.strands.channels.Channels.*;
public class quasarwhispers {
static SuspendableRunnable whisper(LongChannel left, LongChannel right) {
return () -> { right.send(left.receive() + 1); }
}
package foo;
import co.paralleluniverse.fibers.*;
import co.paralleluniverse.strands.*;
import co.paralleluniverse.strands.channels.*;
import static co.paralleluniverse.strands.channels.Channels.*;
public class quasarwhispers {
static void quasarWhispers(int n) throws Exception {
LongChannel leftmost = newLongChannel(0);
LongChannel left = leftmost, right = leftmost;