Hi Lena,

`WaitScope` has a method called `poll()` which checks for new I/O and
handles it without blocking. Maybe you can get away with calling that from
time to time.

If that doesn't work, then it sounds like you may need to implement your
own kj::EventPort to use in place of kj::UnixEventPort. A custom event
allows you to integrate with some other event loop. You will end up needing
to implement your own AsyncIoStream based on this. For an example of
something similar, you could look at how node-capnp implements a custom
event port that uses libuv's event loop (in order to integrate with Node);
see the first part of this file:

https://github.com/capnproto/node-capnp/blob/node10/src/node-capnp/capnp.cc

Obviously, that's a fair amount of work, so hopefully the `poll()` approach
gets you what you want.

-Kenton

On Wed, Dec 2, 2020 at 8:48 AM Lena_work Work <[email protected]> wrote:

> Hi
>
> I'm working on a project where rpc calls and other processing must occur
> in the same thread. That thread may only be interrupted for short periods.
> To achieve this I'm thinking about adding a file descriptor of the IPC to
> the poller in our code. When data is available on this file descriptor IPC
> calls will be processed until either there are none left or the allowed
> time is up.
>
> The class `EventLoop` has a function `run` that is described to be doing
> what seems useful in my case. For this reason it would be helpful to know
> how I can set up an rpc server with an eventloop that I can interact with
> directly?
> Any alternative suggestions would also be greatly appreciated.
>
> - Lena
>
> --
> You received this message because you are subscribed to the Google Groups
> "Cap'n Proto" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/capnproto/53fb3f5f-65dc-4f26-9af4-bfc1e4ff206cn%40googlegroups.com
> <https://groups.google.com/d/msgid/capnproto/53fb3f5f-65dc-4f26-9af4-bfc1e4ff206cn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Cap'n Proto" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/capnproto/CAJouXQ%3D74cTP%2BRKTSTRhxq7xc-PXuhkGHtjuvKi12jw_uYT%3DNA%40mail.gmail.com.

Reply via email to