Skip to content
Discussion options

You must be logged in to vote

Unfortunately, this is likely to be hard. In C++, gRPC has its own event loop that it wants to use, and you generally can't run two event loops in the same thread. There are two options:

  • Run gRPC in a separate thread, and use cross-thread communication (e.g. some sort of mutex-guarded data structure with kj::newPromiseAndCrossThreadFulfiller() for signaling) to communicate between them.
  • Implement a custom kj::EventPort which wraps gRPC's underlying event loop, so that KJ code can operate inside gRPC's loop. This is non-trivial, but it has been done -- node-capnp, for example, implements an EventPort on top of libuv which successfully allowed Cap'n Proto to run inside Node. (Note: That co…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by shaulnv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants