pipe_alloc

Function pipe_alloc 

Source
pub unsafe extern "C" fn pipe_alloc(
    capacity: usize,
    trigger_level: usize,
) -> PipeSideBundle
Expand description

Allocates two connected sides of one pipe.

Creating a pair of sides using this function is the only way to connect two pipe sides together. Two unrelated orphaned sides may never be connected back together.

The capacity and trigger level for both directions are the same when the pipe is created using this function. Use pipe_alloc_ex if you want more control.

§Arguments

  • capacity - Maximum number of bytes buffered in one direction
  • trigger_level - Number of bytes that need to be available in the buffer in order for a blocked thread to unblock

§Returns

Bundle with both sides of the pipe