Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 854255c0 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Expose RpcServer::setMaxThreads in BinderRpc Rust API." into main am:...

Merge "Expose RpcServer::setMaxThreads in BinderRpc Rust API." into main am: 686c83d5 am: ae424b98

Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/3038792



Change-Id: Idc9010a2f79ebadce4393599141c3354961ffae3
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 3e48aa43 ae424b98
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -73,6 +73,17 @@ void ARpcServer_setSupportedFileDescriptorTransportModes(
        const ARpcSession_FileDescriptorTransportMode modes[],
        size_t modes_len);

// Sets the maximum number of threads that the Server will use for
// incoming client connections.
//
// This must be called before adding a client session. This corresponds
// to the number of incoming connections to RpcSession objects in the
// server, which will correspond to the number of outgoing connections
// in client RpcSession objects.
//
// If this is not specified, this will be a single-threaded server.
void ARpcServer_setMaxThreads(ARpcServer* server, size_t threads);

// Runs ARpcServer_join() in a background thread. Immediately returns.
void ARpcServer_start(ARpcServer* server);

+4 −0
Original line number Diff line number Diff line
@@ -167,6 +167,10 @@ void ARpcServer_setSupportedFileDescriptorTransportModes(
    server->setSupportedFileDescriptorTransportModes(modevec);
}

void ARpcServer_setMaxThreads(ARpcServer* handle, size_t threads) {
    handleToStrongPointer<RpcServer>(handle)->setMaxThreads(threads);
}

void ARpcServer_start(ARpcServer* handle) {
    handleToStrongPointer<RpcServer>(handle)->start();
}
+14 −0
Original line number Diff line number Diff line
@@ -147,6 +147,20 @@ impl RpcServerRef {
        }
    }

    /// Sets the max number of threads this Server uses for incoming client connections.
    ///
    /// This must be called before adding a client session. This corresponds
    /// to the number of incoming connections to RpcSession objects in the
    /// server, which will correspond to the number of outgoing connections
    /// in client RpcSession objects. Specifically this is useful for handling
    /// client-side callback connections.
    ///
    /// If this is not specified, this will be a single-threaded server.
    pub fn set_max_threads(&self, count: usize) {
        // SAFETY: RpcServerRef wraps a valid pointer to an ARpcServer.
        unsafe { binder_rpc_unstable_bindgen::ARpcServer_setMaxThreads(self.as_ptr(), count) };
    }

    /// Starts a new background thread and calls join(). Returns immediately.
    pub fn start(&self) {
        // SAFETY: RpcServerRef wraps a valid pointer to an ARpcServer.