19 typename std::enable_if<std::is_same<
decltype(output.get()), Context::Builder>::value>::type*
enable =
nullptr)
30 GuardedRef{thread_context.waiter->m_mutex, thread_context.callback_threads}, &connection,
31 [&] {
return connection.m_threads.add(kj::heap<
ProxyServer<Thread>>(connection, thread_context, std::thread{})); })};
43 auto request = connection.m_thread_map.makeThreadRequest();
44 request.setName(thread_context.thread_name);
45 return request.send().getResult();
48 GuardedRef{thread_context.waiter->m_mutex, thread_context.request_threads},
60 typename std::enable_if<
61 std::is_same<
decltype(Accessor::get(
server_context.call_context.getParams())), Context::Reader>::value,
62 kj::Promise<typename ServerContext::CallContext>>::type
73 auto self = server.thisCap();
106 server_context.request_canceled = true;
112 MP_LOG(loop,
Log::Info) <<
"IPC server request #" << req <<
" canceled while executing.";
133 [&] {
return Accessor::get(call_context.getParams()).getCallbackThread(); });
150 cancel_lock.m_lock.unlock();
174 ConnThreads::node_type removed;
176 Lock lock(thread_context.waiter->m_mutex);
183 MP_LOG(loop,
Log::Info) <<
"IPC server request #" << req <<
" canceled before it could be executed";
184 }
else KJ_IF_MAYBE(exception, kj::runCatchingExceptions([&]{
188 MP_LOG(loop,
Log::Info) <<
"IPC server request #" << req <<
" interrupted (" <<
e.what() <<
")";
191 MP_LOG(loop,
Log::Error) <<
"IPC server request #" << req <<
" uncaught exception (" << kj::str(*exception).cStr() <<
")";
192 kj::throwRecoverableException(kj::mv(*exception));
202 Context::Reader
context_arg = Accessor::get(params);
206 auto* connection = server.m_context.connection;
207 auto& pool = connection->m_thread_pool;
210 <<
"IPC server error request #" << req <<
", no thread specified and no pool configured";
211 throw std::runtime_error(
"no thread specified and no pool configured");
213 auto*
slot = &pool[0];
214 for (
size_t i = 1; i < pool.size(); ++i) {
218 auto result = connection->m_threads.getLocalServer(
slot->client)
219 .then([&loop, invoke = kj::mv(invoke), req](
const kj::Maybe<Thread::Server&>&
perhaps)
mutable -> kj::Promise<typename ServerContext::CallContext> {
223 <<
"IPC server post request #" << req <<
" {" <<
thread.m_thread_context.thread_name <<
"}";
227 <<
"IPC server error request #" << req <<
", pool thread not found";
228 throw std::runtime_error(
"pool thread not found");
232 return connection->m_canceler.wrap(kj::mv(result));
235 auto result = server.m_context.connection->m_threads.getLocalServer(
thread_client)
236 .then([&loop, invoke = kj::mv(invoke), req](
const kj::Maybe<Thread::Server&>&
perhaps)
mutable {
243 <<
"IPC server post request #" << req <<
" {" <<
thread.m_thread_context.thread_name <<
"}";
247 <<
"IPC server error request #" << req <<
", missing thread to execute request";
248 throw std::runtime_error(
"invalid thread handle");
250 }, [&loop, req](::kj::Exception&&
e) -> kj::Promise<typename ServerContext::CallContext> {
282 <<
"IPC server error request #" << req <<
" CapabilityServerSet<Thread>::getLocalServer call failed, did you forget to provide a ThreadMap to the client prior to this IPC call?";
290 return server.m_context.connection->m_canceler.wrap(kj::mv(result));
auto PassField(Priority< 1 >, TypeList< LocalType & >, ServerContext &server_context, Fn &&fn, Args &&... args) -> Require< typename decltype(Accessor::get(server_context.call_context.getParams()))::Calls >
PassField override for callable interface reference arguments.
void CustomBuildField(TypeList< LocalType >, Priority< 1 >, InvokeContext &invoke_context, Value &&value, Output &&output)
Overload multiprocess library's CustomBuildField hook to allow any serializable object to be stored i...