Skip to main content

DeferredReleaseQueue

Trait DeferredReleaseQueue 

Source
pub trait DeferredReleaseQueue:
    Send
    + Sync
    + Debug {
    // Required method
    fn enqueue(
        &self,
        request: PreparedAllocationRelease,
    ) -> Result<(), DeferredEnqueueError>;

    // Provided method
    fn pending(&self) -> usize { ... }
}
Expand description

A provider/context-owned sink for final allocation ownership.

The queue is not owned by this crate. A CUDA provider owns one per context or per stream, records a fence when a request arrives, and calls PreparedAllocationRelease::execute once that fence is observed.

§Contract

  • enqueue is always called with no registry lock and no mechanism lock held, so an implementation may take its own locks freely.
  • enqueue must not block on the device.
  • On refusal, the implementation must return the exact request inside DeferredEnqueueError. It must never drop the request silently to signal failure; dropping it is defined as quarantine, not as free.

Required Methods§

Source

fn enqueue( &self, request: PreparedAllocationRelease, ) -> Result<(), DeferredEnqueueError>

Take final ownership of request.

Provided Methods§

Source

fn pending(&self) -> usize

How many requests are still waiting. Used for observability and for asserting that a queue does not grow without bound.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§