aKode fase 5: rinomina interna (crate akode-*, akode-rs/, akode-cli/, binario akode, AKODE_*, ~/.akode, snapshot)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
23
akode-rs/exec-server/src/rpc_pending_request.rs
Normal file
23
akode-rs/exec-server/src/rpc_pending_request.rs
Normal file
@@ -0,0 +1,23 @@
|
||||
//! Removes client RPC registrations when their call completes or is canceled.
|
||||
//! The pending map is locked only for synchronous bookkeeping, including in Drop.
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::sync::Mutex;
|
||||
|
||||
use akode_exec_server_protocol::RequestId;
|
||||
|
||||
use super::PendingRequest;
|
||||
|
||||
pub(super) struct PendingRequestGuard<'a> {
|
||||
pub(super) pending: &'a Mutex<HashMap<RequestId, PendingRequest>>,
|
||||
pub(super) request_id: RequestId,
|
||||
}
|
||||
|
||||
impl Drop for PendingRequestGuard<'_> {
|
||||
fn drop(&mut self) {
|
||||
self.pending
|
||||
.lock()
|
||||
.unwrap_or_else(std::sync::PoisonError::into_inner)
|
||||
.remove(&self.request_id);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user