I have Cap’nProto RPC (in C++, on macOS) working well on the main thread, but I want to move it to a background thread for various reasons. However, my process is now raising SIGUSR1 signals, which the debugger breaks at, preventing the code from working.
I’m following the directions in the docs: in my background thread’s main function I call kj::setupAsyncIo(), then I call kj::getCurrentThreadExecutor() to get the Executor object. My main thread uses that Executor reference to pass lambdas that will run on the background thread and do the RPC stuff. My immediate problem is that as soon as the main thread schedules a call with the Executor, LLDB (in Xcode) takes control, letting me know that the background thread has raised a SIGUSR1 signal. The backtrace is: * thread #5, stop reason = signal SIGUSR1 * frame #0: 0x00000001ab672eb0 libsystem_kernel.dylib`poll + 8 frame #1: 0x0000000100bb0c78 `kj::UnixEventPort::PollContext::run(int) + 40 frame #2: 0x0000000100bb09ec `kj::UnixEventPort::wait() + 352 frame #3: 0x0000000100ba4710 `kj::EventLoop::wait() + 40 frame #4: 0x0000000100ba4c90 `kj::_::waitImpl(kj::Own<kj::_::PromiseNode>&&, kj::_::ExceptionOrValue&, kj::WaitScope&) + 436 frame #5: 0x0000000100ba52fc `kj::_::NeverDone::wait(kj::WaitScope&) const + 76 … If I continue from this, the code seems to be deadlocked: nothing happens until I kill the process. If I run without LLDB, the process gets past this point; the Executor seems to behave correctly and my lambda starts running on the background thread. However, working without a debugger is unacceptable; there’s no way I’m going to be able to troubleshoot the rest of my code without LLDB. Is there a workaround to this? Like, a way to get LLDB to ignore the signal, or to get Cap’nP to use something other than a signal? I’m guessing I haven’t run into this before because I’ve only been using a single thread and for whatever reason Cap’nProto only uses this signal for inter-thread messaging … ? —Jens -- 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 capnproto+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/capnproto/16B01042-101B-4F3D-8E4F-D17C57DA4960%40mooseyard.com.