Skip to content

Latest commit

 

History

History

examples

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Examples

Six scenarios, implemented with the same names and behavior in every binding. The examples use only the public API.

# Scenario C C++ Rust C#
01 Bounded FIFO job queue c/01_job_queue.c cpp/01_job_queue.cpp rust/01_job_queue.rs csharp/01_job_queue.cs
02 Multi-producer / multi-consumer pool c/02_worker_pool.c cpp/02_worker_pool.cpp rust/02_worker_pool.rs csharp/02_worker_pool.cs
03 Two-process ping-pong c/03_ping_pong.c cpp/03_ping_pong.cpp rust/03_ping_pong.rs csharp/03_ping_pong.cs
04 Zero-copy frames c/04_zero_copy.c cpp/04_zero_copy.cpp rust/04_zero_copy.rs csharp/04_zero_copy.cs
05 Backpressure and cleanup c/05_backpressure.c cpp/05_backpressure.cpp rust/05_backpressure.rs csharp/05_backpressure.cs
06 Streamed 4/8 GiB object c/06_large_object.c cpp/06_large_object.cpp rust/06_large_object.rs csharp/06_large_object.cs

Run

bazel test -c opt //examples/...

Each example is a Bazel test, so one command compiles and runs it. Examples 03–06 use system shared memory and are tagged no-sandbox where the sandbox hides the host namespace.

What each one shows

Example Lesson
01 Full and empty return values; FIFO order.
02 Exactly-once jobs with several producers and consumers.
03 Unique names, bounded retry, deadlines, and cleanup on error.
04 Reserve, write in place, publish, and read in place.
05 Treat no_buffer as backpressure and retire a channel cleanly.
06 Chunk a logical 4/8 GiB object over a dedicated channel; verify every byte without materializing it.

See also