safe_state_operation_with_timeout

Function safe_state_operation_with_timeout 

Source
pub fn safe_state_operation_with_timeout<T, F>(
    operation: F,
    timeout_ms: u64,
    operation_name: &str,
) -> Result<T, CommonError>
where F: FnOnce() -> Result<T, CommonError> + Send + 'static, T: Send + 'static,
Expand description

Safe state operation with timeout protection.

§Arguments

  • operation - The operation to execute
  • timeout_ms - Timeout in milliseconds
  • operation_name - Name of the operation for logging

§Type Parameters

  • T - The return type of the operation
  • F - The operation function type

§Returns

Result containing the operation result or CommonError

§Behavior

  • Executes operation in a separate thread
  • Waits for result or timeout
  • Returns error if timeout occurs