Skip to content

Instantly share code, notes, and snippets.

@rightfold
Created November 17, 2014 21:44
Show Gist options
  • Save rightfold/c8b297ed603ad17b4eb2 to your computer and use it in GitHub Desktop.
Save rightfold/c8b297ed603ad17b4eb2 to your computer and use it in GitHub Desktop.
case Opcode::Send: {
++instructionPointer();
auto channel = pop();
auto value = pop();
dynamic_cast<Channel&>(*channel).send([=] {
scheduledFibers.push(&fiber);
return value;
});
return;
}
case Opcode::Receive: {
++instructionPointer();
auto channel = pop();
dynamic_cast<Channel&>(*channel).receive([=] (GCPtr<> object) {
fiber.evaluationStack.push_back(std::move(object));
scheduledFibers.push(&fiber);
});
return;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment