Hi Reza, Normally you should create your event loop in the main() function or somewhere similarly high-up so that everything in the program can share it. Then you don't need to check whether one exists already.
If you can't do that, then you will need to develop your own mechanism for detecting if an event loop already exists. You could use thread-local variables for this, for example. There is no built-in API for this, sorry. -Kenton On Tue, Jan 22, 2019 at 1:11 AM <[email protected]> wrote: > Maybe I didn't describe my issue well. > > actually I want to check whether if an event loop (AsyncIOContext) is > initiated before for current thread, and if so, be able to access to that. > > > On Monday, January 21, 2019 at 11:14:11 AM UTC+3:30, Reza Alizadeh Majd > wrote: >> >> Hi, >> >> I want to setup multiple EventLoops inside a thread, but when I try to, I >> receive following error: >> >> due to unexpected exception with message: >> kj/async.c++:393: failed: expected threadLocalEventLoop == nullptr; This >> thread already has an EventLoop. >> stack: 7fc5d4b98980 7fc5d4d0548c 569d89 4ce367 4cdafe 4c8cf0 4c8a58 >> 4c7608 >> 4c9fda 4cb128 4caf08 4fe9ea 4ddfe5 7fc5d4211b3d 4bb089 >> >> My use-case is about to Send some sort of requests to an external server >> from current RPCServer. >> For this, I setup RPCClient to access external server. but I received >> above error. >> >> Thanks, >> Reza >> >> -- > 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.
