Dang. Ok, thanks for the quick reply, Jason. I'm still reluctant to let capnp go, in favor of something else here, and it's use is going to be in-house only, so performance won't be a major issue. I'm thinking that it could work if instead of having the "server" end get a object from the client to call, it could make a new RPC connection to the client from the server instead, in a separate thread. That way, each server to client communication path would have it's own event loop, separate from the main server RPC event loop. Then each connection to the clients can use some python thread synchronization and call out to the RPC on events. Feels kind of a bloaty work-around, but I'm willing to give it a try.
How much work would it be to implement the event loop integration you're suggesting ? I'm not that familiar with the low level python going into pycapnp, but I'm fairly fluent in C (and know some C++ but haven't used it as much), just thinking that if it's not a 6 month dev investment, I might be able to find some time to look into it, with some initial guidance as were it would fit. Cheers On Wed, Nov 9, 2016 at 9:09 PM Jason Paryani <[email protected]> wrote: > Fulfilling a promise from another thread is *NOT* safe (see > https://groups.google.com/forum/#!topic/capnproto/zSmTdNGdWg8). I'm not > sure how to accomplish what you're trying to do with pycapnp today, sorry. > > Ideally, pycapnp would grow the ability to integrate with other event > loops, but I'm not sure that's coming anytime soon. > > On Wed, Nov 9, 2016 at 3:26 AM, Andreas Stenius <[email protected]> wrote: > > Hi, > > I'm implementing a RPC server, which should be able to call a function on > a client's object. But, I want to be able to initiate the call from the > server outside of the event loop (or trigger something that will result in > the call being made). > > The examples in pycapnp regarding threads and the event loop used the > getTimer() to delay a call, and thinking along those lines, I tried to see > if I simply could create my own promise, and fullfill that from another > thread at a later time, but haven't figured out how to do it, if at all > possible. > > To give a little more context, what I have is a flask app, and a rpc > server, living in the same process. And I want to call a function on a > client provided object over capnp-rpc from the flask app thread. > > Any hints/pointers ideas welcome :) > > Thanks, > Andreas > > -- > 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]. > Visit this group at https://groups.google.com/group/capnproto. > > > -- > 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]. > Visit this group at https://groups.google.com/group/capnproto. > -- 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]. Visit this group at https://groups.google.com/group/capnproto.
