Re: [capnproto] Integrating KJ with other systems

2020-07-13 Thread 'Kenton Varda' via Cap'n Proto
On Mon, Jul 6, 2020 at 10:54 AM Vitali Lovich wrote: > I think a potential middle ground for this might be to have the stream > give you the fd and a fulfiller. Any I/O operations on the stream then are > blocked from executing until after the promise to return the FD is > fulfilled. > That's

Re: [capnproto] Integrating KJ with other systems

2020-07-06 Thread Vitali Lovich
On Mon, Jul 6, 2020 at 8:34 AM Kenton Varda wrote: > On Mon, Jul 6, 2020 at 10:22 AM Vitali Lovich wrote: > >> I don't feel great about the duplication approach (or allowing retrieving >> the raw handle directly) as it can be subtly tricky to actually use >> correctly. For example, if you dup &

Re: [capnproto] Integrating KJ with other systems

2020-07-06 Thread 'Kenton Varda' via Cap'n Proto
On Mon, Jul 6, 2020 at 10:22 AM Vitali Lovich wrote: > I don't feel great about the duplication approach (or allowing retrieving > the raw handle directly) as it can be subtly tricky to actually use > correctly. For example, if you dup & make the dup'ed FD blocking, that will > impact correct

Re: [capnproto] Integrating KJ with other systems

2020-07-06 Thread Vitali Lovich
On Mon, Jul 6, 2020 at 8:13 AM Kenton Varda wrote: > On Mon, Jul 6, 2020 at 9:28 AM Vitali Lovich wrote: > >> Yeah, that's what I figured. The KJ API is s much more user friendly though :). It would be cool to be able to consume the raw file descriptor/socket out of the pipes the

Re: [capnproto] Integrating KJ with other systems

2020-07-06 Thread 'Kenton Varda' via Cap'n Proto
On Mon, Jul 6, 2020 at 9:28 AM Vitali Lovich wrote: > Yeah, that's what I figured. The KJ API is s much more user friendly >>> though :). It would be cool to be able to consume the raw file >>> descriptor/socket out of the pipes the LowlevelIoProvider constructs to >>> simplify code/error

Re: [capnproto] Integrating KJ with other systems

2020-07-06 Thread Vitali Lovich
On Mon, Jul 6, 2020 at 7:14 AM Kenton Varda wrote: > On Mon, Jul 6, 2020 at 8:02 AM Vitali Lovich wrote: > >> On Sun, Jul 5, 2020 at 3:02 PM Kenton Varda >> wrote: >> >>> On Sun, Jul 5, 2020 at 1:48 PM Vitali Lovich wrote: >>> Yeah, so I'm still working through getting executeSync

Re: [capnproto] Integrating KJ with other systems

2020-07-06 Thread 'Kenton Varda' via Cap'n Proto
On Mon, Jul 6, 2020 at 8:02 AM Vitali Lovich wrote: > On Sun, Jul 5, 2020 at 3:02 PM Kenton Varda wrote: > >> On Sun, Jul 5, 2020 at 1:48 PM Vitali Lovich wrote: >> >>> Yeah, so I'm still working through getting executeSync working. I do >>> wish executeAsync would still be able to do the

Re: [capnproto] Integrating KJ with other systems

2020-07-06 Thread Vitali Lovich
On Sun, Jul 5, 2020 at 3:02 PM Kenton Varda wrote: > On Sun, Jul 5, 2020 at 1:48 PM Vitali Lovich wrote: > >> Yeah, so I'm still working through getting executeSync working. I do wish >> executeAsync would still be able to do the right thing when invoked from >> off-thread to avoid creating

Re: [capnproto] Integrating KJ with other systems

2020-07-05 Thread 'Kenton Varda' via Cap'n Proto
On Sun, Jul 5, 2020 at 1:48 PM Vitali Lovich wrote: > Yeah, so I'm still working through getting executeSync working. I do wish > executeAsync would still be able to do the right thing when invoked from > off-thread to avoid creating artificial synchronization points, but I can > see it being

Re: [capnproto] Integrating KJ with other systems

2020-07-05 Thread Vitali Lovich
Yeah, so I'm still working through getting executeSync working. I do wish executeAsync would still be able to do the right thing when invoked from off-thread to avoid creating artificial synchronization points, but I can see it being challenging to accomplish something like that without adding

Re: [capnproto] Integrating KJ with other systems

2020-07-05 Thread 'Kenton Varda' via Cap'n Proto
I posted an answer on Stack Overflow. On Fri, Jul 3, 2020 at 10:47 PM Vitali Lovich wrote: > I'm trying to integrate cap'n'proto with surrounding threads that don't > use KJ event loops. On Android it's easier because I have an event loop to > adapt to with ALooper (albeit it's crashing -